2019-08-15 03:53:28 +03:00
|
|
|
# Licensed to the Apache Software Foundation (ASF) under one
|
|
|
|
# or more contributor license agreements. See the NOTICE file
|
|
|
|
# distributed with this work for additional information
|
|
|
|
# regarding copyright ownership. The ASF licenses this file
|
|
|
|
# to you under the Apache License, Version 2.0 (the
|
|
|
|
# "License"); you may not use this file except in compliance
|
|
|
|
# with the License. You may obtain a copy of the License at
|
|
|
|
#
|
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
#
|
|
|
|
# Unless required by applicable law or agreed to in writing,
|
|
|
|
# software distributed under the License is distributed on an
|
|
|
|
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
|
|
# KIND, either express or implied. See the License for the
|
|
|
|
# specific language governing permissions and limitations
|
|
|
|
# under the License.
|
|
|
|
---
|
|
|
|
default_stages: [commit, push]
|
2019-08-22 17:13:56 +03:00
|
|
|
default_language_version:
|
|
|
|
# force all unspecified python hooks to run python3
|
|
|
|
python: python3
|
2019-11-04 11:50:06 +03:00
|
|
|
minimum_pre_commit_version: "1.20.0"
|
2019-08-15 03:53:28 +03:00
|
|
|
repos:
|
2019-09-04 16:56:03 +03:00
|
|
|
- repo: https://github.com/Lucas-C/pre-commit-hooks
|
2020-08-18 20:40:18 +03:00
|
|
|
rev: v1.1.9
|
2019-08-16 02:59:35 +03:00
|
|
|
hooks:
|
2019-08-16 17:35:34 +03:00
|
|
|
- id: forbid-tabs
|
2020-07-07 20:48:28 +03:00
|
|
|
exclude: ^docs/Makefile$|^clients/gen/go.sh
|
2019-08-16 02:59:35 +03:00
|
|
|
- id: insert-license
|
2019-10-26 14:31:51 +03:00
|
|
|
name: Add license for all SQL files
|
2019-08-16 02:59:35 +03:00
|
|
|
files: \.sql$
|
2020-06-04 17:45:29 +03:00
|
|
|
exclude: ^\.github/.*$
|
2019-08-16 02:59:35 +03:00
|
|
|
args:
|
|
|
|
- --comment-style
|
|
|
|
- "/*||*/"
|
|
|
|
- --license-filepath
|
|
|
|
- license-templates/LICENSE.txt
|
2019-08-27 21:06:41 +03:00
|
|
|
- --fuzzy-match-generates-todo
|
2019-08-16 03:02:53 +03:00
|
|
|
- id: insert-license
|
2019-10-26 14:31:51 +03:00
|
|
|
name: Add license for all other files
|
2020-06-04 17:45:29 +03:00
|
|
|
exclude: ^\.github/.*$
|
2019-08-16 03:02:53 +03:00
|
|
|
args:
|
|
|
|
- --comment-style
|
|
|
|
- "|#|"
|
|
|
|
- --license-filepath
|
|
|
|
- license-templates/LICENSE.txt
|
2019-08-27 21:06:41 +03:00
|
|
|
- --fuzzy-match-generates-todo
|
2019-08-16 03:02:53 +03:00
|
|
|
files: >
|
2020-06-10 18:20:08 +03:00
|
|
|
\.properties$|\.cfg$|\.conf$|\.ini$|\.ldif$|\.readthedocs$|\.service$|\.tf$|^Dockerfile.*$
|
2019-08-16 07:09:26 +03:00
|
|
|
- id: insert-license
|
2019-10-26 14:31:51 +03:00
|
|
|
name: Add license for all rst files
|
2020-06-04 17:45:29 +03:00
|
|
|
exclude: ^\.github/.*$
|
2019-08-16 07:09:26 +03:00
|
|
|
args:
|
|
|
|
- --comment-style
|
|
|
|
- "||"
|
|
|
|
- --license-filepath
|
|
|
|
- license-templates/LICENSE.rst
|
2019-08-27 21:06:41 +03:00
|
|
|
- --fuzzy-match-generates-todo
|
2019-08-16 07:09:26 +03:00
|
|
|
files: \.rst$
|
2019-08-16 03:06:18 +03:00
|
|
|
- id: insert-license
|
2020-09-02 14:47:34 +03:00
|
|
|
name: Add license for all JS/CSS/PUML files
|
|
|
|
files: \.(js|css|puml)$
|
2020-06-04 17:45:29 +03:00
|
|
|
exclude: ^\.github/.*$
|
2019-08-16 03:06:18 +03:00
|
|
|
args:
|
|
|
|
- --comment-style
|
|
|
|
- "/**| *| */"
|
|
|
|
- --license-filepath
|
|
|
|
- license-templates/LICENSE.txt
|
2019-08-27 21:06:41 +03:00
|
|
|
- --fuzzy-match-generates-todo
|
|
|
|
- id: insert-license
|
2019-10-26 14:31:51 +03:00
|
|
|
name: Add license for all JINJA template files
|
2020-06-29 09:08:58 +03:00
|
|
|
files: "^airflow/www/templates/.*\\.html$|^docs/templates/.*\\.html$.*\\.jinja2"
|
2020-06-04 17:45:29 +03:00
|
|
|
exclude: ^\.github/.*$
|
2019-08-27 21:06:41 +03:00
|
|
|
args:
|
|
|
|
- --comment-style
|
|
|
|
- "{#||#}"
|
|
|
|
- --license-filepath
|
|
|
|
- license-templates/LICENSE.txt
|
|
|
|
- --fuzzy-match-generates-todo
|
2019-08-20 07:07:39 +03:00
|
|
|
- id: insert-license
|
2019-10-26 14:31:51 +03:00
|
|
|
name: Add license for all shell files
|
2020-06-04 17:45:29 +03:00
|
|
|
exclude: ^\.github/.*$
|
2020-01-07 17:38:05 +03:00
|
|
|
files: ^breeze$|^breeze-complete$|\.sh$|\.bash$|\.bats$
|
2019-08-20 07:07:39 +03:00
|
|
|
args:
|
|
|
|
- --comment-style
|
|
|
|
- "|#|"
|
|
|
|
- --license-filepath
|
|
|
|
- license-templates/LICENSE.txt
|
2019-08-27 21:06:41 +03:00
|
|
|
- --fuzzy-match-generates-todo
|
2019-09-17 14:16:32 +03:00
|
|
|
- id: insert-license
|
2019-10-26 14:31:51 +03:00
|
|
|
name: Add license for all python files
|
2020-06-04 17:45:29 +03:00
|
|
|
exclude: ^\.github/.*$
|
2019-09-17 14:16:32 +03:00
|
|
|
types: [python]
|
|
|
|
args:
|
|
|
|
- --comment-style
|
|
|
|
- "|#|"
|
|
|
|
- --license-filepath
|
|
|
|
- license-templates/LICENSE.txt
|
|
|
|
- --fuzzy-match-generates-todo
|
2019-08-20 17:29:34 +03:00
|
|
|
- id: insert-license
|
2019-10-26 14:31:51 +03:00
|
|
|
name: Add license for all XML files
|
2020-06-04 17:45:29 +03:00
|
|
|
exclude: ^\.github/.*$
|
2020-08-24 23:45:28 +03:00
|
|
|
files: \.xml$
|
2019-08-20 17:29:34 +03:00
|
|
|
args:
|
|
|
|
- --comment-style
|
|
|
|
- "<!--||-->"
|
|
|
|
- --license-filepath
|
|
|
|
- license-templates/LICENSE.txt
|
2019-08-27 21:06:41 +03:00
|
|
|
- --fuzzy-match-generates-todo
|
2019-08-22 17:13:56 +03:00
|
|
|
- id: insert-license
|
2019-10-26 14:31:51 +03:00
|
|
|
name: Add license for all yaml files
|
2020-06-04 17:45:29 +03:00
|
|
|
exclude: ^\.github/.*$
|
2019-08-22 17:13:56 +03:00
|
|
|
types: [yaml]
|
2020-08-07 13:47:15 +03:00
|
|
|
files: \.yml$|\.yaml$
|
2019-08-22 17:13:56 +03:00
|
|
|
args:
|
|
|
|
- --comment-style
|
|
|
|
- "|#|"
|
|
|
|
- --license-filepath
|
|
|
|
- license-templates/LICENSE.txt
|
2019-08-27 21:06:41 +03:00
|
|
|
- --fuzzy-match-generates-todo
|
2019-08-22 06:27:54 +03:00
|
|
|
- id: insert-license
|
2019-10-26 14:31:51 +03:00
|
|
|
name: Add license for all md files
|
2019-08-22 06:27:54 +03:00
|
|
|
files: \.md$
|
2020-06-04 17:45:29 +03:00
|
|
|
exclude: ^\.github/.*$|PROVIDERS_CHANGES.*\.md
|
2019-08-22 06:27:54 +03:00
|
|
|
args:
|
|
|
|
- --comment-style
|
|
|
|
- "<!--|| -->"
|
|
|
|
- --license-filepath
|
|
|
|
- license-templates/LICENSE.txt
|
2019-08-27 21:06:41 +03:00
|
|
|
- --fuzzy-match-generates-todo
|
2020-08-24 23:45:28 +03:00
|
|
|
- id: insert-license
|
|
|
|
name: Add license for all mermaid files
|
|
|
|
args:
|
|
|
|
- --comment-style
|
|
|
|
- "|%%|"
|
|
|
|
- --license-filepath
|
|
|
|
- license-templates/LICENSE.txt
|
|
|
|
- --fuzzy-match-generates-todo
|
|
|
|
files: \.mermaid$
|
2019-08-22 06:27:54 +03:00
|
|
|
- repo: https://github.com/thlorenz/doctoc.git
|
|
|
|
rev: v1.4.0
|
|
|
|
hooks:
|
|
|
|
- id: doctoc
|
|
|
|
name: Add TOC for md files
|
2020-05-15 20:00:15 +03:00
|
|
|
files: ^README\.md$|^CONTRIBUTING\.md$|^UPDATING.md$|^dev/README\.md$|^dev/BACKPORT_PACKAGES.md$
|
2019-08-22 06:27:54 +03:00
|
|
|
args:
|
|
|
|
- "--maxlevel"
|
|
|
|
- "2"
|
2019-08-16 17:35:34 +03:00
|
|
|
- repo: meta
|
|
|
|
hooks:
|
|
|
|
- id: check-hooks-apply
|
2020-08-25 14:10:20 +03:00
|
|
|
- repo: https://github.com/psf/black
|
2020-09-09 11:06:24 +03:00
|
|
|
rev: 20.8b1
|
2020-08-25 14:10:20 +03:00
|
|
|
hooks:
|
|
|
|
- id: black
|
2020-08-25 19:39:04 +03:00
|
|
|
files: api_connexion/.*\.py|.*providers.*\.py
|
|
|
|
exclude: .*kubernetes_pod\.py|.*google/common/hooks/base_google\.py$
|
2020-08-25 14:10:20 +03:00
|
|
|
args: [--config=./pyproject.toml]
|
2019-08-16 17:35:34 +03:00
|
|
|
- repo: https://github.com/pre-commit/pre-commit-hooks
|
2020-08-18 20:40:18 +03:00
|
|
|
rev: v3.2.0
|
2019-08-16 17:35:34 +03:00
|
|
|
hooks:
|
|
|
|
- id: check-merge-conflict
|
2019-11-26 11:28:42 +03:00
|
|
|
- id: debug-statements
|
2020-06-25 18:35:37 +03:00
|
|
|
- id: check-builtin-literals
|
2019-08-16 17:35:34 +03:00
|
|
|
- id: detect-private-key
|
|
|
|
- id: end-of-file-fixer
|
|
|
|
- id: mixed-line-ending
|
2019-08-20 17:29:34 +03:00
|
|
|
- id: check-executables-have-shebangs
|
|
|
|
- id: check-xml
|
2019-12-28 21:34:35 +03:00
|
|
|
- id: trailing-whitespace
|
2020-02-04 11:44:35 +03:00
|
|
|
- id: fix-encoding-pragma
|
|
|
|
args:
|
|
|
|
- --remove
|
2019-09-21 22:47:02 +03:00
|
|
|
- repo: https://github.com/pre-commit/pygrep-hooks
|
2020-08-18 20:40:18 +03:00
|
|
|
rev: v1.6.0
|
2019-09-21 22:47:02 +03:00
|
|
|
hooks:
|
|
|
|
- id: rst-backticks
|
2019-09-22 10:55:39 +03:00
|
|
|
- id: python-no-log-warn
|
2020-06-14 03:37:30 +03:00
|
|
|
- repo: https://github.com/adrienverge/yamllint
|
2020-08-18 20:40:18 +03:00
|
|
|
rev: v1.24.2
|
2019-08-15 03:53:28 +03:00
|
|
|
hooks:
|
2019-08-22 17:13:56 +03:00
|
|
|
- id: yamllint
|
|
|
|
name: Check yaml files with yamllint
|
|
|
|
entry: yamllint -c yamllint-config.yml
|
|
|
|
types: [yaml]
|
2020-06-18 01:37:54 +03:00
|
|
|
exclude: ^.*init_git_sync\.template\.yaml$|^.*airflow\.template\.yaml$|^chart/templates/.*\.yaml$
|
2020-06-14 03:37:30 +03:00
|
|
|
- repo: https://github.com/timothycrosley/isort
|
2020-08-18 20:40:18 +03:00
|
|
|
rev: 5.4.2
|
2020-06-14 03:37:30 +03:00
|
|
|
hooks:
|
|
|
|
- id: isort
|
|
|
|
name: Run isort to sort imports
|
|
|
|
types: [python]
|
|
|
|
# To keep consistent with the global isort skip config defined in setup.cfg
|
2020-08-25 19:39:04 +03:00
|
|
|
exclude: ^build/.*$|^.tox/.*$|^venv/.*$|.*api_connexion/.*\.py|.*providers.*\.py
|
2020-06-21 11:34:41 +03:00
|
|
|
- repo: https://github.com/pycqa/pydocstyle
|
|
|
|
rev: 5.0.2
|
|
|
|
hooks:
|
|
|
|
- id: pydocstyle
|
2020-06-21 11:51:57 +03:00
|
|
|
name: Run pydocstyle
|
2020-06-21 11:34:41 +03:00
|
|
|
args:
|
2020-06-21 11:51:57 +03:00
|
|
|
- --convention=pep257
|
2020-09-05 04:26:09 +03:00
|
|
|
- --add-ignore=D100,D102,D104,D105,D107,D200,D202,D204,D205,D400,D401
|
2020-06-21 11:34:41 +03:00
|
|
|
exclude: ^tests/.*\.py$|^scripts/.*\.py$|^dev|^backport_packages|^kubernetes_tests
|
2020-06-14 03:37:30 +03:00
|
|
|
- repo: local
|
|
|
|
hooks:
|
2019-08-20 07:07:39 +03:00
|
|
|
- id: shellcheck
|
|
|
|
name: Check Shell scripts syntax correctness
|
|
|
|
language: docker_image
|
|
|
|
entry: koalaman/shellcheck:stable -x -a
|
2020-01-07 22:38:24 +03:00
|
|
|
files: ^breeze$|^breeze-complete$|\.sh$|^hooks/build$|^hooks/push$|\.bash$|\.bats$
|
2020-06-01 22:46:15 +03:00
|
|
|
- id: lint-openapi
|
2020-09-03 19:06:23 +03:00
|
|
|
name: Lint OpenAPI using spectral
|
2020-06-01 22:46:15 +03:00
|
|
|
language: docker_image
|
2020-09-03 19:06:23 +03:00
|
|
|
entry: stoplight/spectral lint -r ./scripts/ci/spectral_rules/connexion.yml
|
2020-06-02 19:45:37 +03:00
|
|
|
files: ^airflow/api_connexion/openapi/
|
2020-06-01 22:46:15 +03:00
|
|
|
- id: lint-openapi
|
|
|
|
name: Lint OpenAPI using openapi-spec-validator
|
2020-06-02 19:45:37 +03:00
|
|
|
entry: openapi-spec-validator --schema 3.0.0
|
2020-06-01 22:46:15 +03:00
|
|
|
language: python
|
|
|
|
additional_dependencies: ['openapi-spec-validator']
|
2020-06-02 19:45:37 +03:00
|
|
|
files: ^airflow/api_connexion/openapi/
|
2019-08-15 03:53:28 +03:00
|
|
|
- id: lint-dockerfile
|
|
|
|
name: Lint dockerfile
|
|
|
|
language: system
|
2020-07-16 19:05:35 +03:00
|
|
|
entry: "./scripts/ci/pre_commit/pre_commit_lint_dockerfile.sh"
|
2020-09-06 19:06:05 +03:00
|
|
|
files: Dockerfile.*$
|
2019-09-18 14:43:30 +03:00
|
|
|
pass_filenames: true
|
2019-11-30 12:05:14 +03:00
|
|
|
- id: setup-order
|
|
|
|
name: Checks for an order of dependencies in setup.py
|
|
|
|
language: python
|
|
|
|
files: ^setup.py$
|
|
|
|
pass_filenames: false
|
2020-07-16 19:05:35 +03:00
|
|
|
entry: ./scripts/ci/pre_commit/pre_commit_check_order_setup.py
|
2019-11-04 12:37:31 +03:00
|
|
|
- id: update-breeze-file
|
|
|
|
name: Update output of breeze command in BREEZE.rst
|
2020-07-16 19:05:35 +03:00
|
|
|
entry: "./scripts/ci/pre_commit/pre_commit_breeze_cmd_line.sh"
|
2019-11-04 12:37:31 +03:00
|
|
|
language: system
|
|
|
|
files: ^BREEZE.rst$|^breeze$|^breeze-complete$
|
|
|
|
pass_filenames: false
|
2020-03-07 20:12:28 +03:00
|
|
|
- id: update-local-yml-file
|
|
|
|
name: Update mounts in the local yml file
|
2020-07-16 19:05:35 +03:00
|
|
|
entry: "./scripts/ci/pre_commit/pre_commit_local_yml_mounts.sh"
|
2020-03-07 20:12:28 +03:00
|
|
|
language: system
|
2020-06-04 23:12:56 +03:00
|
|
|
files: ^scripts/ci/libraries/_local_mounts.sh$|s^scripts/ci/docker_compose/local.yml"
|
2020-03-07 20:12:28 +03:00
|
|
|
pass_filenames: false
|
2020-02-24 12:29:38 +03:00
|
|
|
- id: update-setup-cfg-file
|
|
|
|
name: Update setup.cfg file with all licenses
|
2020-07-16 19:05:35 +03:00
|
|
|
entry: "./scripts/ci/pre_commit/pre_commit_setup_cfg_file.sh"
|
2020-02-24 12:29:38 +03:00
|
|
|
language: system
|
|
|
|
files: ^setup.cfg$
|
|
|
|
pass_filenames: false
|
2020-03-07 22:55:27 +03:00
|
|
|
- id: build-providers-dependencies
|
|
|
|
name: Build cross-dependencies for providers packages
|
2020-07-16 19:05:35 +03:00
|
|
|
entry: "./scripts/ci/pre_commit/pre_commit_build_providers_dependencies.sh"
|
2020-03-07 22:55:27 +03:00
|
|
|
language: system
|
|
|
|
files: ^airflow/providers/.*\.py$|^tests/providers/.*\.py$
|
|
|
|
pass_filenames: false
|
2020-03-22 15:34:48 +03:00
|
|
|
- id: update-extras
|
|
|
|
name: Update extras in documentation
|
2020-07-16 19:05:35 +03:00
|
|
|
entry: ./scripts/ci/pre_commit/pre_commit_insert_extras.py
|
|
|
|
language: python
|
2020-03-22 15:34:48 +03:00
|
|
|
files: ^setup.py$|^INSTALL$|^CONTRIBUTING.rst$
|
|
|
|
pass_filenames: false
|
2019-11-26 11:28:42 +03:00
|
|
|
- id: pydevd
|
|
|
|
language: pygrep
|
|
|
|
name: Check for pydevd debug statements accidentally left
|
|
|
|
entry: "pydevd.*settrace\\("
|
|
|
|
pass_filenames: true
|
|
|
|
files: \.py$
|
2020-06-09 00:27:02 +03:00
|
|
|
- id: dont-use-safe-filter
|
|
|
|
language: pygrep
|
|
|
|
name: Don't use safe in templates
|
|
|
|
description: the Safe filter is error-prone, use Markup() in code instead
|
|
|
|
entry: "\\|\\s*safe"
|
|
|
|
files: \.html$
|
|
|
|
pass_filenames: true
|
Don't use the term "whitelist" - language matters (#9174)
It's fairly common to say whitelisting and blacklisting to describe
desirable and undesirable things in cyber security. However just because
it is common doesn't mean it's right.
However, there's an issue with the terminology. It only makes sense if
you equate white with 'good, permitted, safe' and black with 'bad,
dangerous, forbidden'. There are some obvious problems with this.
You may not see why this matters. If you're not adversely affected by
racial stereotyping yourself, then please count yourself lucky. For some
of your friends and colleagues (and potential future colleagues), this
really is a change worth making.
From now on, we will use 'allow list' and 'deny list' in place of
'whitelist' and 'blacklist' wherever possible. Which, in fact, is
clearer and less ambiguous. So as well as being more inclusive of all,
this is a net benefit to our understandability.
(Words mostly borrowed from
<https://www.ncsc.gov.uk/blog-post/terminology-its-not-black-and-white>)
Co-authored-by: Jarek Potiuk <jarek@potiuk.com>
2020-06-08 12:01:46 +03:00
|
|
|
- id: language-matters
|
|
|
|
language: pygrep
|
|
|
|
name: Check for language that we do not accept as community
|
|
|
|
description: Please use "deny_list" or "allow_list" instead.
|
|
|
|
entry: "(?i)(black|white)[_-]?list"
|
|
|
|
pass_filenames: true
|
|
|
|
exclude: >
|
|
|
|
(?x)
|
|
|
|
^airflow/providers/apache/cassandra/hooks/cassandra.py$|
|
|
|
|
^airflow/providers/apache/hive/operators/hive_stats.py$|
|
2020-06-16 23:55:42 +03:00
|
|
|
^airflow/providers/apache/hive/PROVIDERS_CHANGES_*|
|
|
|
|
^airflow/providers/apache/hive/README.md$|
|
2020-07-11 21:15:02 +03:00
|
|
|
^tests/providers/apache/cassandra/hooks/test_cassandra.py$|
|
2020-07-19 22:51:59 +03:00
|
|
|
^docs/howto/connection/cassandra.rst$|
|
2020-07-11 21:15:02 +03:00
|
|
|
^CHANGELOG.txt$
|
2019-12-01 14:26:10 +03:00
|
|
|
- id: consistent-pylint
|
|
|
|
language: pygrep
|
|
|
|
name: Check for inconsitent pylint disable/enable without space
|
|
|
|
entry: "pylint:disable|pylint:enable"
|
|
|
|
pass_filenames: true
|
|
|
|
files: \.py$
|
2019-11-27 01:19:45 +03:00
|
|
|
- id: base-operator
|
|
|
|
language: pygrep
|
2019-12-29 23:17:56 +03:00
|
|
|
name: Make sure BaseOperator[Link] is imported from airflow.models.baseoperator in core
|
2019-12-01 13:14:52 +03:00
|
|
|
entry: "from airflow\\.models import.* BaseOperator"
|
2019-11-27 01:19:45 +03:00
|
|
|
files: \.py$
|
|
|
|
pass_filenames: true
|
|
|
|
exclude: >
|
|
|
|
(?x)
|
|
|
|
^airflow/gcp/.*$|
|
|
|
|
^airflow/hooks/.*$|
|
|
|
|
^airflow/operators/.*$|
|
|
|
|
^airflow/sensors/.*$|
|
|
|
|
^airflow/providers/.*$|
|
2020-05-26 03:43:16 +03:00
|
|
|
^backport_packages/.*$
|
2019-11-27 01:19:45 +03:00
|
|
|
- id: base-operator
|
|
|
|
language: pygrep
|
2019-12-29 23:17:56 +03:00
|
|
|
name: Make sure BaseOperator[Link] is imported from airflow.models outside of core
|
2019-12-01 13:14:52 +03:00
|
|
|
entry: "from airflow\\.models\\.baseoperator import.* BaseOperator"
|
2019-11-27 01:19:45 +03:00
|
|
|
pass_filenames: true
|
|
|
|
files: >
|
|
|
|
(?x)
|
|
|
|
^airflow/gcp/.*$|
|
|
|
|
^airflow/hooks/.*$|
|
|
|
|
^airflow/operators/.*$|
|
|
|
|
^airflow/sensors/.*$|
|
2020-06-29 09:08:58 +03:00
|
|
|
^airflow/providers/.*\.py$
|
2020-02-02 12:14:14 +03:00
|
|
|
- id: provide-create-sessions
|
|
|
|
language: pygrep
|
2020-05-15 20:00:15 +03:00
|
|
|
name: To avoid import cycles make sure provide_session and create_session are imported from
|
|
|
|
airflow.utils.session
|
2020-02-02 12:14:14 +03:00
|
|
|
entry: "from airflow\\.utils\\.db import.* (provide_session|create_session)"
|
|
|
|
files: \.py$
|
|
|
|
pass_filenames: true
|
2020-02-02 22:48:03 +03:00
|
|
|
- id: incorrect-use-of-LoggingMixin
|
|
|
|
language: pygrep
|
|
|
|
name: Make sure LoggingMixin is not used alone
|
|
|
|
entry: "LoggingMixin\\(\\)"
|
|
|
|
files: \.py$
|
|
|
|
pass_filenames: true
|
2020-02-03 00:55:49 +03:00
|
|
|
- id: daysago-import-check
|
|
|
|
language: pygrep
|
|
|
|
name: Make sure days_ago is imported from airflow.utils.dates
|
|
|
|
entry: "(airflow\\.){0,1}utils\\.dates\\.days_ago"
|
|
|
|
files: \.py$
|
|
|
|
pass_filenames: true
|
2020-09-08 15:06:42 +03:00
|
|
|
- id: restrict-start_date
|
2020-07-25 02:16:25 +03:00
|
|
|
language: pygrep
|
|
|
|
name: "'start_date' should not be defined in default_args in example_dags"
|
2020-07-25 21:57:32 +03:00
|
|
|
entry: "default_args\\s*=\\s*{\\s*(\"|')start_date(\"|')|(\"|')start_date(\"|'):"
|
2020-07-25 02:16:25 +03:00
|
|
|
files: \.*example_dags.*.py$
|
|
|
|
pass_filenames: true
|
2020-04-22 15:38:56 +03:00
|
|
|
- id: check-integrations
|
|
|
|
name: Check if integration list is aligned
|
2020-07-16 19:05:35 +03:00
|
|
|
entry: ./scripts/ci/pre_commit/pre_commit_check_integrations.sh
|
2020-04-22 15:38:56 +03:00
|
|
|
language: system
|
|
|
|
pass_filenames: false
|
2020-08-24 23:45:28 +03:00
|
|
|
files: ^common/_common_values.sh$|^breeze-complete$
|
2019-11-04 17:59:48 +03:00
|
|
|
- id: build
|
|
|
|
name: Check if image build is needed
|
2020-07-16 19:05:35 +03:00
|
|
|
entry: ./scripts/ci/pre_commit/pre_commit_ci_build.sh 3.6 false
|
2019-11-04 17:59:48 +03:00
|
|
|
language: system
|
|
|
|
always_run: true
|
|
|
|
pass_filenames: false
|
|
|
|
- id: check-apache-license
|
|
|
|
name: Check if licenses are OK for Apache
|
2020-07-16 19:05:35 +03:00
|
|
|
entry: "./scripts/ci/pre_commit/pre_commit_check_license.sh"
|
2019-11-04 17:59:48 +03:00
|
|
|
language: system
|
|
|
|
files: ^.*LICENSE.*$|^.*LICENCE.*$
|
|
|
|
pass_filenames: false
|
2020-01-09 00:48:22 +03:00
|
|
|
- id: airflow-config-yaml
|
|
|
|
name: Checks for consistency between config.yml and default_config.cfg
|
|
|
|
language: python
|
2020-07-16 19:05:35 +03:00
|
|
|
entry: ./scripts/ci/pre_commit/pre_commit_yaml_to_cfg.py
|
2020-03-14 10:10:59 +03:00
|
|
|
files: "config.yml$|default_airflow.cfg$|default.cfg$"
|
2020-01-09 00:48:22 +03:00
|
|
|
pass_filenames: false
|
2020-07-16 19:05:35 +03:00
|
|
|
require_serial: true
|
2020-01-09 00:48:22 +03:00
|
|
|
additional_dependencies: ['pyyaml']
|
2019-08-15 03:53:28 +03:00
|
|
|
- id: mypy
|
|
|
|
name: Run mypy
|
|
|
|
language: system
|
2020-07-16 19:05:35 +03:00
|
|
|
entry: "./scripts/ci/pre_commit/pre_commit_mypy.sh"
|
2019-08-15 03:53:28 +03:00
|
|
|
files: \.py$
|
2020-06-04 17:45:29 +03:00
|
|
|
exclude: ^dev|^backport_packages
|
2020-02-19 23:20:59 +03:00
|
|
|
require_serial: true
|
2019-08-15 03:53:28 +03:00
|
|
|
- id: pylint
|
2020-08-07 12:07:15 +03:00
|
|
|
name: Run pylint
|
2019-08-15 03:53:28 +03:00
|
|
|
language: system
|
2020-08-07 12:07:15 +03:00
|
|
|
entry: "./scripts/ci/pre_commit/pre_commit_pylint.sh"
|
2019-08-15 03:53:28 +03:00
|
|
|
files: \.py$
|
2020-08-07 12:07:15 +03:00
|
|
|
exclude: ^scripts/.*\.py$|^dev|^backport_packages
|
2019-09-18 14:43:30 +03:00
|
|
|
pass_filenames: true
|
2020-08-25 21:04:51 +03:00
|
|
|
require_serial: true
|
2019-08-15 03:53:28 +03:00
|
|
|
- id: flake8
|
|
|
|
name: Run flake8
|
|
|
|
language: system
|
2020-07-16 19:05:35 +03:00
|
|
|
entry: "./scripts/ci/pre_commit/pre_commit_flake8.sh"
|
2019-08-15 03:53:28 +03:00
|
|
|
files: \.py$
|
2019-09-18 14:43:30 +03:00
|
|
|
pass_filenames: true
|
2020-01-07 17:38:05 +03:00
|
|
|
- id: bat-tests
|
2020-01-19 15:15:43 +03:00
|
|
|
name: Run BATS bash tests for changed bash files
|
2020-01-07 17:38:05 +03:00
|
|
|
language: system
|
2020-07-16 19:05:35 +03:00
|
|
|
entry: "./scripts/ci/pre_commit/pre_commit_bat_tests.sh"
|
2020-01-19 15:15:43 +03:00
|
|
|
files: ^breeze$|^breeze-complete$|\.sh$|\.bash$
|
|
|
|
pass_filenames: false
|
2020-04-09 23:50:17 +03:00
|
|
|
- id: stylelint
|
|
|
|
name: stylelint
|
|
|
|
entry: "stylelint"
|
|
|
|
language: node
|
|
|
|
files: ^airflow/www/.*\.(css|scss|sass)$
|
|
|
|
# Keep dependency versions in sync w/ airflow/www/package.json
|
|
|
|
additional_dependencies: ['stylelint@13.3.1', 'stylelint-config-standard@20.0.0']
|
2020-08-24 23:45:28 +03:00
|
|
|
- id: mermaid
|
|
|
|
name: Generate mermaid images
|
|
|
|
entry: ./scripts/ci/pre_commit/pre_commit_mermaid.sh
|
|
|
|
language: system
|
|
|
|
files: \.mermaid$
|
|
|
|
require_serial: true
|
2020-09-08 15:06:42 +03:00
|
|
|
- id: pre-commit-descriptions
|
|
|
|
name: Check if pre-commits are described
|
|
|
|
entry: ./scripts/ci/pre_commit/pre_commit_check_pre_commits.sh
|
|
|
|
language: system
|
|
|
|
files: ^.pre-commit-config.yaml$|^STATIC_CODE_CHECKS.rst|^breeze-complete$
|
|
|
|
require_serial: true
|