2019-08-14 20:53:28 -04: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 10:13:56 -04:00
|
|
|
default_language_version:
|
|
|
|
|
python: python3
|
2022-07-21 00:23:08 +02:00
|
|
|
node: 18.6.0
|
2023-02-13 01:04:11 +10:00
|
|
|
minimum_pre_commit_version: '2.0.0'
|
2019-08-14 20:53:28 -04:00
|
|
|
repos:
|
2020-12-16 14:14:20 +01:00
|
|
|
- repo: meta
|
|
|
|
|
hooks:
|
|
|
|
|
- id: identity
|
2022-04-23 21:33:08 +02:00
|
|
|
name: Print input to the static check hooks for troubleshooting
|
2020-12-16 14:14:20 +01:00
|
|
|
- id: check-hooks-apply
|
2022-04-23 21:33:08 +02:00
|
|
|
name: Check if all hooks apply to the repository
|
2022-02-15 23:52:50 +01:00
|
|
|
- repo: https://github.com/thlorenz/doctoc.git
|
2022-06-02 15:11:23 +02:00
|
|
|
rev: v2.2.0
|
2022-02-15 23:52:50 +01:00
|
|
|
hooks:
|
|
|
|
|
- id: doctoc
|
2023-02-13 01:04:11 +10:00
|
|
|
name: Add TOC for Markdown and RST files
|
2022-02-15 23:52:50 +01:00
|
|
|
files:
|
2022-04-01 22:49:24 +10:00
|
|
|
^CONTRIBUTING\.md$|^README\.md$|^UPDATING.*\.md$|^chart/UPDATING.*\.md$|^dev/.*\.md$|^dev/.*\.rst$
|
2023-04-08 18:41:41 +02:00
|
|
|
exclude: ^.*/.*_vendor/
|
2022-02-15 23:52:50 +01:00
|
|
|
args:
|
|
|
|
|
- "--maxlevel"
|
|
|
|
|
- "2"
|
2019-09-04 15:56:03 +02:00
|
|
|
- repo: https://github.com/Lucas-C/pre-commit-hooks
|
2023-11-06 08:30:26 +01:00
|
|
|
rev: v1.5.4
|
2019-08-15 19:59:35 -04:00
|
|
|
hooks:
|
|
|
|
|
- id: insert-license
|
2019-10-26 13:31:51 +02:00
|
|
|
name: Add license for all SQL files
|
2019-08-15 19:59:35 -04:00
|
|
|
files: \.sql$
|
2022-10-23 17:17:26 +01:00
|
|
|
exclude: |
|
|
|
|
|
(?x)
|
|
|
|
|
^\.github/|
|
2023-04-08 18:41:41 +02:00
|
|
|
^.*/.*_vendor/
|
2019-08-15 19:59:35 -04:00
|
|
|
args:
|
|
|
|
|
- --comment-style
|
|
|
|
|
- "/*||*/"
|
|
|
|
|
- --license-filepath
|
2023-08-19 01:54:31 -06:00
|
|
|
- scripts/ci/license-templates/LICENSE.txt
|
2019-08-27 14:06:41 -04:00
|
|
|
- --fuzzy-match-generates-todo
|
2019-08-16 00:09:26 -04:00
|
|
|
- id: insert-license
|
2023-02-13 01:04:11 +10:00
|
|
|
name: Add license for all RST files
|
2023-04-08 18:41:41 +02:00
|
|
|
exclude: ^\.github/.*$|^.*/.*_vendor/|newsfragments/.*\.rst$
|
2019-08-16 00:09:26 -04:00
|
|
|
args:
|
|
|
|
|
- --comment-style
|
|
|
|
|
- "||"
|
|
|
|
|
- --license-filepath
|
2023-08-19 01:54:31 -06:00
|
|
|
- scripts/ci/license-templates/LICENSE.rst
|
2019-08-27 14:06:41 -04:00
|
|
|
- --fuzzy-match-generates-todo
|
2019-08-16 00:09:26 -04:00
|
|
|
files: \.rst$
|
2019-08-15 20:06:18 -04:00
|
|
|
- id: insert-license
|
2023-02-13 01:04:11 +10:00
|
|
|
name: Add license for all CSS/JS/JSX/PUML/TS/TSX files
|
|
|
|
|
files: \.(css|jsx?|puml|tsx?)$
|
2023-04-08 18:41:41 +02:00
|
|
|
exclude: ^\.github/.*$|^.*/.*_vendor/
|
2019-08-15 20:06:18 -04:00
|
|
|
args:
|
|
|
|
|
- --comment-style
|
2020-10-16 03:59:09 -04:00
|
|
|
- "/*!| *| */"
|
2019-08-15 20:06:18 -04:00
|
|
|
- --license-filepath
|
2023-08-19 01:54:31 -06:00
|
|
|
- scripts/ci/license-templates/LICENSE.txt
|
2019-08-27 14:06:41 -04:00
|
|
|
- --fuzzy-match-generates-todo
|
|
|
|
|
- id: insert-license
|
2019-10-26 13:31:51 +02:00
|
|
|
name: Add license for all JINJA template files
|
2022-03-08 09:00:46 +10:00
|
|
|
files: ^airflow/www/templates/.*\.html$
|
2023-04-08 18:41:41 +02:00
|
|
|
exclude: ^\.github/.*$|^.*/.*_vendor/
|
2019-08-27 14:06:41 -04:00
|
|
|
args:
|
|
|
|
|
- --comment-style
|
|
|
|
|
- "{#||#}"
|
|
|
|
|
- --license-filepath
|
2023-08-19 01:54:31 -06:00
|
|
|
- scripts/ci/license-templates/LICENSE.txt
|
2019-08-27 14:06:41 -04:00
|
|
|
- --fuzzy-match-generates-todo
|
2019-08-20 00:07:39 -04:00
|
|
|
- id: insert-license
|
2023-02-13 01:04:11 +10:00
|
|
|
name: Add license for all Shell files
|
2023-04-08 18:41:41 +02:00
|
|
|
exclude: ^\.github/.*$|^.*/.*_vendor/|^dev/breeze/autocomplete/.*$
|
2022-09-02 23:20:45 +02:00
|
|
|
files: \.bash$|\.sh$
|
2019-08-20 00:07:39 -04:00
|
|
|
args:
|
|
|
|
|
- --comment-style
|
|
|
|
|
- "|#|"
|
|
|
|
|
- --license-filepath
|
2023-08-19 01:54:31 -06:00
|
|
|
- scripts/ci/license-templates/LICENSE.txt
|
2019-08-27 14:06:41 -04:00
|
|
|
- --fuzzy-match-generates-todo
|
2019-09-17 13:16:32 +02:00
|
|
|
- id: insert-license
|
2021-05-06 12:36:32 +10:00
|
|
|
name: Add license for all Python files
|
2023-04-08 18:41:41 +02:00
|
|
|
exclude: ^\.github/.*$|^.*/.*_vendor/
|
2021-12-27 16:46:22 +01:00
|
|
|
files: \.py$|\.pyi$
|
2019-09-17 13:16:32 +02:00
|
|
|
args:
|
|
|
|
|
- --comment-style
|
|
|
|
|
- "|#|"
|
|
|
|
|
- --license-filepath
|
2023-08-19 01:54:31 -06:00
|
|
|
- scripts/ci/license-templates/LICENSE.txt
|
2019-09-17 13:16:32 +02:00
|
|
|
- --fuzzy-match-generates-todo
|
2019-08-20 10:29:34 -04:00
|
|
|
- id: insert-license
|
2019-10-26 13:31:51 +02:00
|
|
|
name: Add license for all XML files
|
2023-04-08 18:41:41 +02:00
|
|
|
exclude: ^\.github/.*$|^.*/.*_vendor/
|
2020-08-24 22:45:28 +02:00
|
|
|
files: \.xml$
|
2019-08-20 10:29:34 -04:00
|
|
|
args:
|
|
|
|
|
- --comment-style
|
|
|
|
|
- "<!--||-->"
|
|
|
|
|
- --license-filepath
|
2023-08-19 01:54:31 -06:00
|
|
|
- scripts/ci/license-templates/LICENSE.txt
|
2019-08-27 14:06:41 -04:00
|
|
|
- --fuzzy-match-generates-todo
|
2019-08-22 10:13:56 -04:00
|
|
|
- id: insert-license
|
2023-04-22 23:22:29 +02:00
|
|
|
name: Add license for all Helm template files
|
|
|
|
|
files: ^chart/templates/.*
|
|
|
|
|
args:
|
|
|
|
|
- --comment-style
|
|
|
|
|
- "{{/*||*/}}"
|
|
|
|
|
- --license-filepath
|
2023-08-19 01:54:31 -06:00
|
|
|
- scripts/ci/license-templates/LICENSE.txt
|
2023-04-22 23:22:29 +02:00
|
|
|
- --fuzzy-match-generates-todo
|
|
|
|
|
- id: insert-license
|
|
|
|
|
name: Add license for all YAML files except Helm templates
|
|
|
|
|
exclude: ^\.github/.*$|^.*/.*_vendor/|^chart/templates/.*
|
2019-08-22 10:13:56 -04:00
|
|
|
types: [yaml]
|
2023-02-13 01:04:11 +10:00
|
|
|
files: \.ya?ml$
|
2019-08-22 10:13:56 -04:00
|
|
|
args:
|
|
|
|
|
- --comment-style
|
|
|
|
|
- "|#|"
|
|
|
|
|
- --license-filepath
|
2023-08-19 01:54:31 -06:00
|
|
|
- scripts/ci/license-templates/LICENSE.txt
|
2019-08-27 14:06:41 -04:00
|
|
|
- --fuzzy-match-generates-todo
|
2019-08-21 23:27:54 -04:00
|
|
|
- id: insert-license
|
2023-02-13 01:04:11 +10:00
|
|
|
name: Add license for all Markdown files
|
2019-08-21 23:27:54 -04:00
|
|
|
files: \.md$
|
2023-06-30 10:49:40 +02:00
|
|
|
exclude: PROVIDER_CHANGES.*\.md$|^.*/.*_vendor/
|
2019-08-21 23:27:54 -04:00
|
|
|
args:
|
|
|
|
|
- --comment-style
|
|
|
|
|
- "<!--|| -->"
|
|
|
|
|
- --license-filepath
|
2023-08-19 01:54:31 -06:00
|
|
|
- scripts/ci/license-templates/LICENSE.txt
|
2019-08-27 14:06:41 -04:00
|
|
|
- --fuzzy-match-generates-todo
|
2022-04-23 21:33:08 +02:00
|
|
|
- id: insert-license
|
|
|
|
|
name: Add license for all other files
|
2023-04-08 18:41:41 +02:00
|
|
|
exclude: ^\.github/.*$|^.*/.*_vendor/
|
2022-04-23 21:33:08 +02:00
|
|
|
args:
|
|
|
|
|
- --comment-style
|
|
|
|
|
- "|#|"
|
|
|
|
|
- --license-filepath
|
2023-08-19 01:54:31 -06:00
|
|
|
- scripts/ci/license-templates/LICENSE.txt
|
2022-04-23 21:33:08 +02:00
|
|
|
- --fuzzy-match-generates-todo
|
|
|
|
|
files: >
|
|
|
|
|
\.cfg$|\.conf$|\.ini$|\.ldif$|\.properties$|\.readthedocs$|\.service$|\.tf$|Dockerfile.*$
|
2022-12-18 17:04:48 +01:00
|
|
|
- repo: local
|
|
|
|
|
hooks:
|
|
|
|
|
- id: update-common-sql-api-stubs
|
|
|
|
|
name: Check and update common.sql API stubs
|
|
|
|
|
entry: ./scripts/ci/pre_commit/pre_commit_update_common_sql_api_stubs.py
|
|
|
|
|
language: python
|
|
|
|
|
files: ^scripts/ci/pre_commit/pre_commit_update_common_sql_api\.py|^airflow/providers/common/sql/.*\.pyi?$
|
2023-10-18 21:28:24 +02:00
|
|
|
additional_dependencies: ['rich>=12.4.4', 'mypy==1.2.0', 'black==23.10.0', 'jinja2']
|
2022-12-18 17:04:48 +01:00
|
|
|
pass_filenames: false
|
|
|
|
|
require_serial: true
|
2022-12-24 16:08:40 +01:00
|
|
|
- id: update-black-version
|
|
|
|
|
name: Update black versions everywhere
|
|
|
|
|
entry: ./scripts/ci/pre_commit/pre_commit_update_black_version.py
|
|
|
|
|
language: python
|
|
|
|
|
files: ^.pre-commit-config.yaml$
|
|
|
|
|
additional_dependencies: ['pyyaml']
|
|
|
|
|
pass_filenames: false
|
|
|
|
|
require_serial: true
|
2023-10-20 02:19:35 +04:00
|
|
|
- repo: https://github.com/astral-sh/ruff-pre-commit
|
2023-11-06 08:30:26 +01:00
|
|
|
rev: v0.1.4
|
2023-10-20 02:19:35 +04:00
|
|
|
hooks:
|
|
|
|
|
# Since ruff makes use of multiple cores we _purposefully_ don't run this in docker so it can use the
|
|
|
|
|
# host CPU to it's fullest
|
2023-01-12 21:40:23 +00:00
|
|
|
- id: ruff
|
2023-10-31 18:51:50 -04:00
|
|
|
name: ruff-lint
|
|
|
|
|
args: [--fix]
|
2023-04-14 10:22:19 -07:00
|
|
|
exclude: ^.*/.*_vendor/|^tests/dags/test_imports.py
|
2023-10-31 18:51:50 -04:00
|
|
|
- id: ruff-format
|
|
|
|
|
name: ruff-format
|
|
|
|
|
exclude: ^.*/.*_vendor/|^tests/dags/test_imports.py|^airflow/contrib/
|
2021-05-27 07:09:25 +02:00
|
|
|
- repo: https://github.com/asottile/blacken-docs
|
2023-10-18 21:28:24 +02:00
|
|
|
rev: 1.16.0
|
2021-05-27 07:09:25 +02:00
|
|
|
hooks:
|
|
|
|
|
- id: blacken-docs
|
2023-02-13 01:04:11 +10:00
|
|
|
name: Run black on Python code blocks in documentation files
|
2022-07-01 20:12:15 +02:00
|
|
|
args:
|
|
|
|
|
- --line-length=110
|
|
|
|
|
- --target-version=py37
|
|
|
|
|
- --target-version=py38
|
|
|
|
|
- --target-version=py39
|
|
|
|
|
- --target-version=py310
|
2023-10-31 18:51:50 -04:00
|
|
|
alias: blacken-docs
|
2023-10-18 21:28:24 +02:00
|
|
|
additional_dependencies: [black==23.10.0]
|
2019-08-16 10:35:34 -04:00
|
|
|
- repo: https://github.com/pre-commit/pre-commit-hooks
|
2023-10-18 21:28:24 +02:00
|
|
|
rev: v4.5.0
|
2019-08-16 10:35:34 -04:00
|
|
|
hooks:
|
|
|
|
|
- id: check-merge-conflict
|
2022-04-23 21:33:08 +02:00
|
|
|
name: Check that merge conflicts are not being committed
|
2019-11-26 09:28:42 +01:00
|
|
|
- id: debug-statements
|
2022-04-23 21:33:08 +02:00
|
|
|
name: Detect accidentally committed debug statements
|
2020-06-25 16:35:37 +01:00
|
|
|
- id: check-builtin-literals
|
2023-05-24 11:21:52 -07:00
|
|
|
name: Require literal syntax when initializing builtin types
|
2023-04-08 18:41:41 +02:00
|
|
|
exclude: ^.*/.*_vendor/
|
2019-08-16 10:35:34 -04:00
|
|
|
- id: detect-private-key
|
2022-04-23 21:33:08 +02:00
|
|
|
name: Detect if private key is added to the repository
|
2023-02-07 23:43:07 +01:00
|
|
|
exclude: ^docs/apache-airflow-providers-ssh/connections/ssh.rst$
|
2019-08-16 10:35:34 -04:00
|
|
|
- id: end-of-file-fixer
|
2022-04-23 21:33:08 +02:00
|
|
|
name: Make sure that there is an empty line at the end
|
2023-04-08 18:41:41 +02:00
|
|
|
exclude: ^.*/.*_vendor/|^docs/apache-airflow/img/.*\.dot|^docs/apache-airflow/img/.*\.sha256
|
2019-08-16 10:35:34 -04:00
|
|
|
- id: mixed-line-ending
|
2022-04-23 21:33:08 +02:00
|
|
|
name: Detect if mixed line ending is used (\r vs. \r\n)
|
2023-04-08 18:41:41 +02:00
|
|
|
exclude: ^.*/.*_vendor/
|
2019-08-20 10:29:34 -04:00
|
|
|
- id: check-executables-have-shebangs
|
2022-04-23 21:33:08 +02:00
|
|
|
name: Check that executables have shebang
|
2023-04-08 18:41:41 +02:00
|
|
|
exclude: ^.*/.*_vendor/
|
2019-08-20 10:29:34 -04:00
|
|
|
- id: check-xml
|
2022-04-23 21:33:08 +02:00
|
|
|
name: Check XML files with xmllint
|
2023-04-08 18:41:41 +02:00
|
|
|
exclude: ^.*/.*_vendor/
|
2019-12-28 19:34:35 +01:00
|
|
|
- id: trailing-whitespace
|
2022-04-23 21:33:08 +02:00
|
|
|
name: Remove trailing whitespace at end of line
|
2023-04-08 18:41:41 +02:00
|
|
|
exclude: ^.*/.*_vendor/|^docs/apache-airflow/img/.*\.dot|^images/breeze/output.*$
|
2020-02-04 09:44:35 +01:00
|
|
|
- id: fix-encoding-pragma
|
2023-02-13 01:04:11 +10:00
|
|
|
name: Remove encoding header from Python files
|
2023-04-08 18:41:41 +02:00
|
|
|
exclude: ^.*/.*_vendor/
|
2020-02-04 09:44:35 +01:00
|
|
|
args:
|
|
|
|
|
- --remove
|
2021-05-17 12:23:45 -06:00
|
|
|
- id: pretty-format-json
|
2023-02-13 01:04:11 +10:00
|
|
|
name: Format JSON files
|
2021-05-17 12:23:45 -06:00
|
|
|
args:
|
|
|
|
|
- --autofix
|
|
|
|
|
- --no-sort-keys
|
|
|
|
|
- --indent
|
|
|
|
|
- "4"
|
|
|
|
|
files: ^chart/values\.schema\.json$|^chart/values_schema\.schema\.json$
|
|
|
|
|
pass_filenames: true
|
2019-09-21 20:47:02 +01:00
|
|
|
- repo: https://github.com/pre-commit/pygrep-hooks
|
2023-01-23 12:48:33 +01:00
|
|
|
rev: v1.10.0
|
2019-09-21 20:47:02 +01:00
|
|
|
hooks:
|
|
|
|
|
- id: rst-backticks
|
2022-04-23 21:33:08 +02:00
|
|
|
name: Check if RST files use double backticks for code
|
2023-04-08 18:41:41 +02:00
|
|
|
exclude: ^.*/.*_vendor/
|
2019-09-22 08:55:39 +01:00
|
|
|
- id: python-no-log-warn
|
2022-04-23 21:33:08 +02:00
|
|
|
name: Check if there are no deprecate log warn
|
2023-04-08 18:41:41 +02:00
|
|
|
exclude: ^.*/.*_vendor/
|
2020-06-14 02:37:30 +02:00
|
|
|
- repo: https://github.com/adrienverge/yamllint
|
2023-10-18 21:28:24 +02:00
|
|
|
rev: v1.32.0
|
2019-08-14 20:53:28 -04:00
|
|
|
hooks:
|
2019-08-22 10:13:56 -04:00
|
|
|
- id: yamllint
|
2021-05-06 12:36:32 +10:00
|
|
|
name: Check YAML files with yamllint
|
2020-10-21 12:24:32 +02:00
|
|
|
entry: yamllint -c yamllint-config.yml --strict
|
2019-08-22 10:13:56 -04:00
|
|
|
types: [yaml]
|
2023-04-08 18:41:41 +02:00
|
|
|
exclude: ^.*airflow\.template\.yaml$|^.*init_git_sync\.template\.yaml$|^.*/.*_vendor/|^chart/(?:templates|files)/.*\.yaml$|openapi/.*\.yaml$|^\.pre-commit-config\.yaml$
|
2021-09-10 11:54:15 -06:00
|
|
|
- repo: https://github.com/ikamensh/flynt
|
2023-10-18 21:28:24 +02:00
|
|
|
rev: '1.0.1'
|
2021-08-18 01:56:38 +02:00
|
|
|
hooks:
|
|
|
|
|
- id: flynt
|
2022-04-23 21:33:08 +02:00
|
|
|
name: Run flynt string format converter for Python
|
2021-08-18 01:56:38 +02:00
|
|
|
exclude: |
|
|
|
|
|
(?x)
|
2023-04-08 18:41:41 +02:00
|
|
|
^.*/.*_vendor/
|
2021-10-17 18:34:06 +02:00
|
|
|
args:
|
|
|
|
|
# If flynt detects too long text it ignores it. So we set a very large limit to make it easy
|
|
|
|
|
# to split the text by hand. Too long lines are detected by flake8 (below),
|
|
|
|
|
# so the user is informed to take action.
|
|
|
|
|
- --line-length
|
|
|
|
|
- '99999'
|
2021-10-14 19:37:08 +01:00
|
|
|
- repo: https://github.com/codespell-project/codespell
|
2023-10-18 21:28:24 +02:00
|
|
|
rev: v2.2.6
|
2021-10-14 19:37:08 +01:00
|
|
|
hooks:
|
|
|
|
|
- id: codespell
|
|
|
|
|
name: Run codespell to check for common misspellings in files
|
2021-10-30 15:44:20 +05:30
|
|
|
entry: bash -c 'echo "If you think that this failure is an error, consider adding the word(s)
|
|
|
|
|
to the codespell dictionary at docs/spelling_wordlist.txt.
|
|
|
|
|
The word(s) should be in lowercase." && exec codespell "$@"' --
|
2021-10-14 19:37:08 +01:00
|
|
|
language: python
|
|
|
|
|
types: [text]
|
2023-10-18 21:28:24 +02:00
|
|
|
exclude: ^.*/.*_vendor/|^airflow/www/static/css/material-icons\.css$|^images/.*$|^RELEASE_NOTES\.txt$|^.*package-lock\.json$|^.*/kinglear\.txt$
|
2021-10-14 19:37:08 +01:00
|
|
|
args:
|
|
|
|
|
- --ignore-words=docs/spelling_wordlist.txt
|
2023-02-13 01:04:11 +10:00
|
|
|
- --skip=airflow/providers/*/*.rst,airflow/www/*.log,docs/*/commits.rst,docs/apache-airflow/tutorial/pipeline_example.csv,*.min.js,*.lock,INTHEWILD.md
|
2022-01-24 12:43:09 +00:00
|
|
|
- --exclude-file=.codespellignorelines
|
2023-09-04 11:56:18 +04:00
|
|
|
- repo: https://github.com/abravalheri/validate-pyproject
|
2023-10-18 21:28:24 +02:00
|
|
|
rev: v0.15
|
2023-09-04 11:56:18 +04:00
|
|
|
hooks:
|
|
|
|
|
- id: validate-pyproject
|
|
|
|
|
name: Validate pyproject.toml
|
2020-06-14 02:37:30 +02:00
|
|
|
- repo: local
|
2023-04-21 17:53:48 +02:00
|
|
|
# Note that this is the 2nd "local" repo group in the .pre-commit-config.yaml file. This is because
|
|
|
|
|
# we try to minimise the number of passes that must happen in order to apply some of the changes
|
|
|
|
|
# done by pre-commits. Some of the pre-commits not only check for errors but also fix them. This means
|
|
|
|
|
# that output from an earlier pre-commit becomes input to another pre-commit. Splitting the local
|
|
|
|
|
# scripts of our and adding some other non-local pre-commit in-between allows us to handle such
|
|
|
|
|
# changes quickly - especially when we want the early modifications from the first local group
|
|
|
|
|
# to be applied before the non-local pre-commits are run
|
2020-06-14 02:37:30 +02:00
|
|
|
hooks:
|
2022-07-05 17:08:52 +02:00
|
|
|
- id: replace-bad-characters
|
|
|
|
|
name: Replace bad characters
|
|
|
|
|
entry: ./scripts/ci/pre_commit/pre_commit_replace_bad_characters.py
|
|
|
|
|
language: python
|
|
|
|
|
types: [file, text]
|
2023-04-08 18:41:41 +02:00
|
|
|
exclude: ^.*/.*_vendor/|^clients/gen/go\.sh$|^\.gitmodules$
|
2022-07-05 17:08:52 +02:00
|
|
|
additional_dependencies: ['rich>=12.4.4']
|
2020-06-01 21:46:15 +02:00
|
|
|
- id: lint-openapi
|
2020-09-03 17:06:23 +01:00
|
|
|
name: Lint OpenAPI using spectral
|
2020-06-01 21:46:15 +02:00
|
|
|
language: docker_image
|
2020-09-03 17:06:23 +01:00
|
|
|
entry: stoplight/spectral lint -r ./scripts/ci/spectral_rules/connexion.yml
|
2020-06-02 18:45:37 +02:00
|
|
|
files: ^airflow/api_connexion/openapi/
|
2020-06-01 21:46:15 +02:00
|
|
|
- id: lint-openapi
|
|
|
|
|
name: Lint OpenAPI using openapi-spec-validator
|
2020-06-02 18:45:37 +02:00
|
|
|
entry: openapi-spec-validator --schema 3.0.0
|
2020-06-01 21:46:15 +02:00
|
|
|
language: python
|
2023-07-11 09:06:26 +02:00
|
|
|
additional_dependencies: ['openapi-spec-validator>=0.6.0']
|
2020-06-02 18:45:37 +02:00
|
|
|
files: ^airflow/api_connexion/openapi/
|
2019-08-14 20:53:28 -04:00
|
|
|
- id: lint-dockerfile
|
2023-02-13 01:04:11 +10:00
|
|
|
name: Lint Dockerfile
|
2022-09-02 17:21:41 +02:00
|
|
|
language: python
|
|
|
|
|
entry: ./scripts/ci/pre_commit/pre_commit_lint_dockerfile.py
|
2020-09-06 18:06:05 +02:00
|
|
|
files: Dockerfile.*$
|
2019-09-18 13:43:30 +02:00
|
|
|
pass_filenames: true
|
2021-02-27 18:38:43 +01:00
|
|
|
require_serial: true
|
2022-04-23 21:33:08 +02:00
|
|
|
- id: check-setup-order
|
2021-05-06 12:36:32 +10:00
|
|
|
name: Check order of dependencies in setup.cfg and setup.py
|
2019-11-30 17:05:14 +08:00
|
|
|
language: python
|
2021-05-06 12:36:32 +10:00
|
|
|
files: ^setup\.cfg$|^setup\.py$
|
2019-11-30 17:05:14 +08:00
|
|
|
pass_filenames: false
|
2020-07-16 18:05:35 +02:00
|
|
|
entry: ./scripts/ci/pre_commit/pre_commit_check_order_setup.py
|
2022-06-04 20:43:44 +02:00
|
|
|
additional_dependencies: ['rich>=12.4.4']
|
2023-07-26 08:25:02 +02:00
|
|
|
- id: check-airflow-k8s-not-used
|
|
|
|
|
name: Check airflow.kubernetes imports are not used
|
|
|
|
|
language: python
|
|
|
|
|
files: ^airflow/.*\.py$
|
|
|
|
|
require_serial: true
|
|
|
|
|
exclude: ^airflow/kubernetes/
|
|
|
|
|
entry: ./scripts/ci/pre_commit/pre_commit_check_airflow_k8s_not_used.py
|
|
|
|
|
additional_dependencies: ['rich>=12.4.4']
|
|
|
|
|
- id: check-cncf-k8s-only-for-executors
|
|
|
|
|
name: Check cncf.kubernetes imports used for executors only
|
|
|
|
|
language: python
|
|
|
|
|
files: ^airflow/.*\.py$
|
|
|
|
|
require_serial: true
|
|
|
|
|
exclude: ^airflow/kubernetes/|^airflow/providers/
|
|
|
|
|
entry: ./scripts/ci/pre_commit/pre_commit_check_cncf_k8s_used_for_k8s_executor_only.py
|
|
|
|
|
additional_dependencies: ['rich>=12.4.4']
|
2022-04-23 21:33:08 +02:00
|
|
|
- id: check-extra-packages-references
|
2020-12-26 02:24:27 -08:00
|
|
|
name: Checks setup extra packages
|
|
|
|
|
description: Checks if all the libraries in setup.py are listed in extra-packages-ref.rst file
|
2020-11-02 14:17:41 +01:00
|
|
|
language: python
|
2023-04-04 23:00:08 +02:00
|
|
|
files: ^setup\.py$|^docs/apache-airflow/extra-packages-ref\.rst$|^airflow/providers/.*/provider\.yaml$
|
2020-11-02 14:17:41 +01:00
|
|
|
pass_filenames: false
|
2020-11-13 09:38:54 +01:00
|
|
|
entry: ./scripts/ci/pre_commit/pre_commit_check_setup_extra_packages_ref.py
|
2022-06-04 20:43:44 +02:00
|
|
|
additional_dependencies: ['rich>=12.4.4']
|
2022-10-24 21:05:58 +02:00
|
|
|
- id: check-airflow-provider-compatibility
|
|
|
|
|
name: Check compatibility of Providers with Airflow
|
|
|
|
|
entry: ./scripts/ci/pre_commit/pre_commit_check_provider_airflow_compatibility.py
|
2022-03-22 22:01:02 +01:00
|
|
|
language: python
|
|
|
|
|
pass_filenames: true
|
|
|
|
|
files: ^airflow/providers/.*\.py$
|
2022-06-04 20:43:44 +02:00
|
|
|
additional_dependencies: ['rich>=12.4.4']
|
2023-08-09 02:46:37 +02:00
|
|
|
- id: check-google-re2-as-dependency
|
|
|
|
|
name: Check google-re2 is declared as dependency when needed
|
|
|
|
|
entry: ./scripts/ci/pre_commit/pre_commit_check_google_re2_imports.py
|
|
|
|
|
language: python
|
|
|
|
|
pass_filenames: true
|
|
|
|
|
require_serial: true
|
|
|
|
|
files: ^airflow/providers/.*\.py$
|
|
|
|
|
additional_dependencies: ['rich>=12.4.4']
|
2020-03-07 18:12:28 +01:00
|
|
|
- id: update-local-yml-file
|
|
|
|
|
name: Update mounts in the local yml file
|
2022-05-28 17:19:14 +02:00
|
|
|
entry: ./scripts/ci/pre_commit/pre_commit_local_yml_mounts.py
|
|
|
|
|
language: python
|
|
|
|
|
files: ^dev/breeze/src/airflow_breeze/utils/docker_command_utils\.py$|^scripts/ci/docker_compose/local\.yml$
|
2020-03-07 18:12:28 +01:00
|
|
|
pass_filenames: false
|
2022-06-04 20:43:44 +02:00
|
|
|
additional_dependencies: ['rich>=12.4.4']
|
2022-04-23 21:33:08 +02:00
|
|
|
- id: update-providers-dependencies
|
|
|
|
|
name: Update cross-dependencies for providers packages
|
2022-10-30 03:56:16 +01:00
|
|
|
entry: ./scripts/ci/pre_commit/pre_commit_update_providers_dependencies.py
|
2021-06-20 14:32:11 +02:00
|
|
|
language: python
|
2023-02-13 01:04:11 +10:00
|
|
|
files: ^airflow/providers/.*\.py$|^airflow/providers/.*/provider\.yaml$|^tests/providers/.*\.py$|^tests/system/providers/.*\.py$
|
2020-03-07 20:55:27 +01:00
|
|
|
pass_filenames: false
|
2022-06-29 18:38:29 +02:00
|
|
|
additional_dependencies: ['setuptools', 'rich>=12.4.4', 'pyyaml']
|
2020-03-22 13:34:48 +01:00
|
|
|
- id: update-extras
|
|
|
|
|
name: Update extras in documentation
|
2020-07-16 18:05:35 +02:00
|
|
|
entry: ./scripts/ci/pre_commit/pre_commit_insert_extras.py
|
|
|
|
|
language: python
|
2023-04-04 23:00:08 +02:00
|
|
|
files: ^setup\.py$|^CONTRIBUTING\.rst$|^INSTALL$|^airflow/providers/.*/provider\.yaml$
|
2020-03-22 13:34:48 +01:00
|
|
|
pass_filenames: false
|
2023-01-23 12:48:33 +01:00
|
|
|
additional_dependencies: ['rich>=12.4.4']
|
2021-09-21 21:22:41 +02:00
|
|
|
- id: check-extras-order
|
|
|
|
|
name: Check order of extras in Dockerfile
|
|
|
|
|
entry: ./scripts/ci/pre_commit/pre_commit_check_order_dockerfile_extras.py
|
|
|
|
|
language: python
|
|
|
|
|
files: ^Dockerfile$
|
|
|
|
|
pass_filenames: false
|
2022-06-04 20:43:44 +02:00
|
|
|
additional_dependencies: ['rich>=12.4.4']
|
2021-12-30 22:13:10 +01:00
|
|
|
- id: update-supported-versions
|
|
|
|
|
name: Updates supported versions in documentation
|
2022-04-23 09:12:11 +02:00
|
|
|
entry: ./scripts/ci/pre_commit/pre_commit_supported_versions.py
|
2021-12-30 22:13:10 +01:00
|
|
|
language: python
|
2023-02-13 01:04:11 +10:00
|
|
|
files: ^docs/apache-airflow/installation/supported-versions\.rst$|^scripts/ci/pre_commit/pre_commit_supported_versions\.py$|^README\.md$
|
2021-12-30 22:13:10 +01:00
|
|
|
pass_filenames: false
|
|
|
|
|
additional_dependencies: ['tabulate']
|
2022-04-08 18:20:54 +01:00
|
|
|
- id: check-revision-heads-map
|
|
|
|
|
name: Check that the REVISION_HEADS_MAP is up-to-date
|
|
|
|
|
language: python
|
|
|
|
|
entry: ./scripts/ci/pre_commit/pre_commit_version_heads_map.py
|
|
|
|
|
pass_filenames: false
|
2023-08-29 12:30:26 -07:00
|
|
|
files: >
|
|
|
|
|
(?x)
|
|
|
|
|
^scripts/ci/pre_commit/pre_commit_version_heads_map\.py$|
|
|
|
|
|
^airflow/migrations/versions/.*$|^airflow/migrations/versions|
|
|
|
|
|
^airflow/utils/db.py$
|
2023-08-22 21:56:31 +01:00
|
|
|
additional_dependencies: ['packaging','google-re2']
|
2021-09-18 10:41:57 +02:00
|
|
|
- id: update-version
|
|
|
|
|
name: Update version to the latest version in the documentation
|
|
|
|
|
entry: ./scripts/ci/pre_commit/pre_commit_update_versions.py
|
|
|
|
|
language: python
|
|
|
|
|
files: ^docs
|
|
|
|
|
pass_filenames: false
|
2022-04-23 21:33:08 +02:00
|
|
|
- id: check-pydevd-left-in-code
|
2019-11-26 09:28:42 +01:00
|
|
|
language: pygrep
|
|
|
|
|
name: Check for pydevd debug statements accidentally left
|
|
|
|
|
entry: "pydevd.*settrace\\("
|
|
|
|
|
pass_filenames: true
|
|
|
|
|
files: \.py$
|
2022-12-05 20:06:49 +01:00
|
|
|
- id: check-links-to-example-dags-do-not-use-hardcoded-versions
|
2023-05-24 11:21:52 -07:00
|
|
|
name: Verify example dags do not use hard-coded version numbers
|
2022-12-05 20:06:49 +01:00
|
|
|
description: The links to example dags should use |version| as version specification
|
|
|
|
|
language: pygrep
|
|
|
|
|
entry: >
|
|
|
|
|
(?i)
|
|
|
|
|
.*https://github.*[0-9]/tests/system/providers|
|
|
|
|
|
.*https://github.*/main/tests/system/providers|
|
|
|
|
|
.*https://github.*/master/tests/system/providers|
|
|
|
|
|
.*https://github.*/main/airflow/providers/.*/example_dags/|
|
|
|
|
|
.*https://github.*/master/airflow/providers/.*/example_dags/
|
|
|
|
|
pass_filenames: true
|
|
|
|
|
files: ^docs/apache-airflow-providers-.*\.rst
|
2022-04-23 21:33:08 +02:00
|
|
|
- id: check-safe-filter-usage-in-html
|
2020-06-08 22:27:02 +01:00
|
|
|
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
|
2022-04-23 21:33:08 +02:00
|
|
|
- id: check-no-providers-in-core-examples
|
2020-11-10 22:49:08 +01:00
|
|
|
language: pygrep
|
|
|
|
|
name: No providers imports in core example DAGs
|
|
|
|
|
description: The core example DAGs have no dependencies other than core Airflow
|
|
|
|
|
entry: "^\\s*from airflow\\.providers.*"
|
|
|
|
|
pass_filenames: true
|
|
|
|
|
files: ^airflow/example_dags/.*\.py$
|
2023-05-04 00:08:37 +03:00
|
|
|
- id: check-no-airflow-deprecation-in-providers
|
|
|
|
|
language: pygrep
|
|
|
|
|
name: Do not use DeprecationWarning in providers
|
|
|
|
|
description: Use AirflowProviderDeprecationWarning in providers
|
|
|
|
|
entry: "^\\s*DeprecationWarning*"
|
|
|
|
|
pass_filenames: true
|
|
|
|
|
files: ^airflow/providers/.*\.py$
|
2022-04-23 21:33:08 +02:00
|
|
|
- id: check-no-relative-imports
|
2020-09-10 18:07:50 +01:00
|
|
|
language: pygrep
|
|
|
|
|
name: No relative imports
|
2022-06-13 19:38:20 +02:00
|
|
|
description: Airflow style is to use absolute imports only (except docs building)
|
2020-09-10 18:07:50 +01:00
|
|
|
entry: "^\\s*from\\s+\\."
|
|
|
|
|
pass_filenames: true
|
|
|
|
|
files: \.py$
|
2023-04-08 18:41:41 +02:00
|
|
|
exclude: ^.*/.*_vendor/|^docs/|^tests/
|
2023-02-20 10:06:12 +09:00
|
|
|
- id: check-urlparse-usage-in-code
|
|
|
|
|
language: pygrep
|
|
|
|
|
name: Don't use urlparse in code
|
|
|
|
|
description: urlparse is not recommended, use urlsplit() in code instead
|
|
|
|
|
entry: "^\\s*from urllib\\.parse import ((\\|, )(urlparse\\|urlunparse))+$"
|
|
|
|
|
pass_filenames: true
|
|
|
|
|
files: \.py$
|
2022-12-19 17:38:55 +08:00
|
|
|
- id: check-only-new-session-with-provide-session
|
|
|
|
|
name: Check NEW_SESSION is only used with @provide_session
|
|
|
|
|
language: python
|
|
|
|
|
entry: ./scripts/ci/pre_commit/pre_commit_new_session_in_provide_session.py
|
|
|
|
|
pass_filenames: true
|
|
|
|
|
files: ^airflow/.+\.py$
|
2022-04-23 21:33:08 +02:00
|
|
|
- id: check-for-inclusive-language
|
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 10:01:46 +01:00
|
|
|
language: pygrep
|
|
|
|
|
name: Check for language that we do not accept as community
|
2022-05-09 16:52:29 -05:00
|
|
|
description: Please use more appropriate words for community documentation.
|
|
|
|
|
entry: >
|
2023-02-22 09:45:03 -05:00
|
|
|
(?ix)
|
2022-05-09 16:52:29 -05:00
|
|
|
(black|white)[_-]?list|
|
|
|
|
|
\bshe\b|
|
|
|
|
|
\bhe\b|
|
|
|
|
|
\bher\b|
|
|
|
|
|
\bhis\b|
|
|
|
|
|
\bmaster\b|
|
|
|
|
|
\bslave\b|
|
|
|
|
|
\bsanity\b|
|
|
|
|
|
\bdummy\b
|
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 10:01:46 +01:00
|
|
|
pass_filenames: true
|
|
|
|
|
exclude: >
|
|
|
|
|
(?x)
|
2023-02-22 09:45:03 -05:00
|
|
|
^airflow/api_connexion/openapi/v1.yaml$|
|
2023-08-15 10:21:24 -04:00
|
|
|
^airflow/auth/managers/fab/security_manager/|
|
2023-02-22 09:45:03 -05:00
|
|
|
^airflow/cli/commands/webserver_command.py$|
|
2023-10-24 10:16:47 +02:00
|
|
|
^airflow/cli/commands/internal_api_command.py$|
|
2023-02-22 09:45:03 -05:00
|
|
|
^airflow/config_templates/|
|
|
|
|
|
^airflow/models/baseoperator.py$|
|
|
|
|
|
^airflow/operators/__init__.py$|
|
|
|
|
|
^airflow/providers/amazon/aws/hooks/emr.py$|
|
|
|
|
|
^airflow/providers/amazon/aws/operators/emr.py$|
|
|
|
|
|
^airflow/providers/apache/cassandra/hooks/cassandra.py$|
|
|
|
|
|
^airflow/providers/apache/hive/operators/hive_stats.py$|
|
|
|
|
|
^airflow/providers/apache/hive/transfers/vertica_to_hive.py$|
|
2023-11-01 11:42:58 +01:00
|
|
|
^airflow/providers/apache/spark/decorators/|
|
2023-02-22 09:45:03 -05:00
|
|
|
^airflow/providers/apache/spark/hooks/|
|
|
|
|
|
^airflow/providers/apache/spark/operators/|
|
|
|
|
|
^airflow/providers/exasol/hooks/exasol.py$|
|
|
|
|
|
^airflow/providers/google/cloud/hooks/bigquery.py$|
|
|
|
|
|
^airflow/providers/google/cloud/operators/cloud_build.py$|
|
|
|
|
|
^airflow/providers/google/cloud/operators/dataproc.py$|
|
|
|
|
|
^airflow/providers/google/cloud/operators/mlengine.py$|
|
|
|
|
|
^airflow/providers/microsoft/azure/hooks/cosmos.py$|
|
|
|
|
|
^airflow/providers/microsoft/winrm/hooks/winrm.py$|
|
|
|
|
|
^airflow/www/fab_security/manager.py$|
|
|
|
|
|
^docs/.*commits.rst$|
|
2023-07-01 23:56:33 +02:00
|
|
|
^docs/apache-airflow/security/webserver.rst$|
|
2023-02-22 09:45:03 -05:00
|
|
|
^docs/apache-airflow-providers-apache-cassandra/connections/cassandra.rst$|
|
|
|
|
|
^airflow/providers/microsoft/winrm/operators/winrm.py$|
|
|
|
|
|
^airflow/providers/opsgenie/hooks/opsgenie.py$|
|
|
|
|
|
^airflow/providers/redis/provider.yaml$|
|
|
|
|
|
^airflow/serialization/serialized_objects.py$|
|
|
|
|
|
^airflow/utils/db.py$|
|
|
|
|
|
^airflow/utils/trigger_rule.py$|
|
|
|
|
|
^airflow/www/static/css/bootstrap-theme.css$|
|
|
|
|
|
^airflow/www/static/js/types/api-generated.ts$|
|
|
|
|
|
^airflow/www/templates/appbuilder/flash.html$|
|
2023-04-08 18:41:41 +02:00
|
|
|
^.*/.*_vendor/|
|
2023-02-22 09:45:03 -05:00
|
|
|
^dev/|
|
|
|
|
|
^docs/README.rst$|
|
|
|
|
|
^docs/apache-airflow-providers-amazon/secrets-backends/aws-ssm-parameter-store.rst$|
|
|
|
|
|
^docs/apache-airflow-providers-apache-hdfs/connections.rst$|
|
2023-04-21 13:15:30 -04:00
|
|
|
^docs/apache-airflow-providers-apache-kafka/connections/kafka.rst$|
|
2023-11-01 11:42:58 +01:00
|
|
|
^docs/apache-airflow-providers-apache-spark/decorators/pyspark.rst$|
|
2023-02-22 09:45:03 -05:00
|
|
|
^docs/apache-airflow-providers-google/operators/cloud/kubernetes_engine.rst$|
|
|
|
|
|
^docs/apache-airflow-providers-microsoft-azure/connections/azure_cosmos.rst$|
|
|
|
|
|
^docs/conf.py$|
|
|
|
|
|
^docs/exts/removemarktransform.py$|
|
|
|
|
|
^scripts/ci/pre_commit/pre_commit_vendor_k8s_json_schema.py$|
|
|
|
|
|
^tests/|
|
2022-05-09 16:52:29 -05:00
|
|
|
^.pre-commit-config\.yaml$|
|
2023-02-13 01:04:11 +10:00
|
|
|
^.*CHANGELOG\.(rst|txt)$|
|
2022-05-09 16:52:29 -05:00
|
|
|
^.*RELEASE_NOTES\.rst$|
|
2023-02-22 09:45:03 -05:00
|
|
|
^CONTRIBUTORS_QUICK_START.rst$|
|
|
|
|
|
^.*\.(png|gif|jp[e]?g|tgz|lock)$|
|
2022-03-04 04:35:59 -07:00
|
|
|
git
|
2022-06-02 01:07:45 -04:00
|
|
|
- id: check-base-operator-partial-arguments
|
|
|
|
|
name: Check BaseOperator and partial() arguments
|
|
|
|
|
language: python
|
|
|
|
|
entry: ./scripts/ci/pre_commit/pre_commit_base_operator_partial_arguments.py
|
|
|
|
|
pass_filenames: false
|
2022-09-01 08:51:41 +08:00
|
|
|
files: ^airflow/models/(?:base|mapped)operator\.py$
|
2022-09-23 16:16:17 +08:00
|
|
|
- id: check-init-decorator-arguments
|
|
|
|
|
name: Check model __init__ and decorator arguments are in sync
|
2022-09-01 08:51:41 +08:00
|
|
|
language: python
|
2022-09-23 16:16:17 +08:00
|
|
|
entry: ./scripts/ci/pre_commit/pre_commit_sync_init_decorator.py
|
2022-09-01 08:51:41 +08:00
|
|
|
pass_filenames: false
|
2023-02-13 01:04:11 +10:00
|
|
|
files: ^airflow/models/dag\.py$|^airflow/(?:decorators|utils)/task_group\.py$
|
2022-04-23 21:33:08 +02:00
|
|
|
- id: check-base-operator-usage
|
2019-11-26 23:19:45 +01:00
|
|
|
language: pygrep
|
2020-12-26 02:24:27 -08:00
|
|
|
name: Check BaseOperator[Link] core imports
|
|
|
|
|
description: Make sure BaseOperator[Link] is imported from airflow.models.baseoperator in core
|
2019-12-01 11:14:52 +01:00
|
|
|
entry: "from airflow\\.models import.* BaseOperator"
|
2019-11-26 23:19:45 +01:00
|
|
|
files: \.py$
|
|
|
|
|
pass_filenames: true
|
|
|
|
|
exclude: >
|
|
|
|
|
(?x)
|
2021-03-12 13:43:32 -08:00
|
|
|
^airflow/decorators/.*$|
|
2019-11-26 23:19:45 +01:00
|
|
|
^airflow/hooks/.*$|
|
|
|
|
|
^airflow/operators/.*$|
|
|
|
|
|
^airflow/providers/.*$|
|
2023-02-13 01:04:11 +10:00
|
|
|
^airflow/sensors/.*$|
|
2020-11-09 13:27:10 +01:00
|
|
|
^dev/provider_packages/.*$
|
2022-04-23 21:33:08 +02:00
|
|
|
- id: check-base-operator-usage
|
2019-11-26 23:19:45 +01:00
|
|
|
language: pygrep
|
2020-12-26 02:24:27 -08:00
|
|
|
name: Check BaseOperator[Link] other imports
|
|
|
|
|
description: Make sure BaseOperator[Link] is imported from airflow.models outside of core
|
2019-12-01 11:14:52 +01:00
|
|
|
entry: "from airflow\\.models\\.baseoperator import.* BaseOperator"
|
2019-11-26 23:19:45 +01:00
|
|
|
pass_filenames: true
|
|
|
|
|
files: >
|
|
|
|
|
(?x)
|
2020-06-29 08:08:58 +02:00
|
|
|
^airflow/providers/.*\.py$
|
2023-04-08 18:41:41 +02:00
|
|
|
exclude: ^.*/.*_vendor/
|
2022-08-19 12:11:02 +08:00
|
|
|
- id: check-decorated-operator-implements-custom-name
|
|
|
|
|
name: Check @task decorator implements custom_operator_name
|
|
|
|
|
language: python
|
|
|
|
|
entry: ./scripts/ci/pre_commit/pre_commit_decorator_operator_implements_custom_name.py
|
|
|
|
|
pass_filenames: true
|
|
|
|
|
files: ^airflow/.*\.py$
|
2022-08-24 00:18:18 +03:00
|
|
|
- id: check-core-deprecation-classes
|
|
|
|
|
language: pygrep
|
2023-05-24 11:21:52 -07:00
|
|
|
name: Verify usage of Airflow deprecation classes in core
|
2022-08-24 00:18:18 +03:00
|
|
|
entry: category=DeprecationWarning|category=PendingDeprecationWarning
|
|
|
|
|
files: \.py$
|
2023-02-13 01:04:11 +10:00
|
|
|
exclude: ^airflow/configuration\.py$|^airflow/providers|^scripts/in_container/verify_providers\.py$
|
2022-08-24 00:18:18 +03:00
|
|
|
pass_filenames: true
|
2022-04-23 21:33:08 +02:00
|
|
|
- id: check-provide-create-sessions-imports
|
2020-02-02 01:14:14 -08:00
|
|
|
language: pygrep
|
2020-12-26 02:24:27 -08:00
|
|
|
name: Check provide_session and create_session imports
|
|
|
|
|
description: provide_session and create_session should be imported from airflow.utils.session
|
|
|
|
|
to avoid import cycles.
|
2020-02-02 01:14:14 -08:00
|
|
|
entry: "from airflow\\.utils\\.db import.* (provide_session|create_session)"
|
|
|
|
|
files: \.py$
|
2023-04-08 18:41:41 +02:00
|
|
|
exclude: ^.*/.*_vendor/
|
2020-02-02 01:14:14 -08:00
|
|
|
pass_filenames: true
|
2022-04-23 21:33:08 +02:00
|
|
|
- id: check-incorrect-use-of-LoggingMixin
|
2020-02-02 20:48:03 +01:00
|
|
|
language: pygrep
|
|
|
|
|
name: Make sure LoggingMixin is not used alone
|
|
|
|
|
entry: "LoggingMixin\\(\\)"
|
|
|
|
|
files: \.py$
|
2023-04-08 18:41:41 +02:00
|
|
|
exclude: ^.*/.*_vendor/
|
2020-02-02 20:48:03 +01:00
|
|
|
pass_filenames: true
|
2022-04-23 21:33:08 +02:00
|
|
|
- id: check-daysago-import-from-utils
|
2020-02-03 03:25:49 +05:30
|
|
|
language: pygrep
|
|
|
|
|
name: Make sure days_ago is imported from airflow.utils.dates
|
|
|
|
|
entry: "(airflow\\.){0,1}utils\\.dates\\.days_ago"
|
|
|
|
|
files: \.py$
|
2023-04-08 18:41:41 +02:00
|
|
|
exclude: ^.*/.*_vendor/
|
2020-02-03 03:25:49 +05:30
|
|
|
pass_filenames: true
|
2022-04-23 21:33:08 +02:00
|
|
|
- id: check-start-date-not-used-in-defaults
|
2020-07-25 00:16:25 +01:00
|
|
|
language: pygrep
|
2023-05-24 11:21:52 -07:00
|
|
|
name: start_date not to be defined in default_args in example_dags
|
2020-07-25 19:57:32 +01:00
|
|
|
entry: "default_args\\s*=\\s*{\\s*(\"|')start_date(\"|')|(\"|')start_date(\"|'):"
|
2021-05-06 12:36:32 +10:00
|
|
|
files: \.*example_dags.*\.py$
|
2023-04-08 18:41:41 +02:00
|
|
|
exclude: ^.*/.*_vendor/
|
2020-07-25 00:16:25 +01:00
|
|
|
pass_filenames: true
|
2022-04-23 21:33:08 +02:00
|
|
|
- id: check-apache-license-rat
|
2019-11-04 15:59:48 +01:00
|
|
|
name: Check if licenses are OK for Apache
|
2022-09-02 13:49:20 +02:00
|
|
|
entry: ./scripts/ci/pre_commit/pre_commit_check_license.py
|
|
|
|
|
language: python
|
2019-11-04 15:59:48 +01:00
|
|
|
files: ^.*LICENSE.*$|^.*LICENCE.*$
|
|
|
|
|
pass_filenames: false
|
2023-05-04 14:44:22 +02:00
|
|
|
- id: check-aiobotocore-optional
|
|
|
|
|
name: Check if aiobotocore is an optional dependency only
|
|
|
|
|
entry: ./scripts/ci/pre_commit/pre_commit_check_aiobotocore_optional.py
|
|
|
|
|
language: python
|
|
|
|
|
files: ^airflow/providers/.*/provider\.yaml$
|
|
|
|
|
pass_filenames: true
|
|
|
|
|
additional_dependencies: ['click', 'rich>=12.4.4', 'pyyaml']
|
|
|
|
|
require_serial: true
|
2022-04-23 21:33:08 +02:00
|
|
|
- id: check-boring-cyborg-configuration
|
2021-06-04 22:02:36 +02:00
|
|
|
name: Checks for Boring Cyborg configuration consistency
|
|
|
|
|
language: python
|
|
|
|
|
entry: ./scripts/ci/pre_commit/pre_commit_boring_cyborg.py
|
|
|
|
|
pass_filenames: false
|
|
|
|
|
require_serial: true
|
|
|
|
|
additional_dependencies: ['pyyaml', 'termcolor==1.1.0', 'wcmatch==8.2']
|
2022-04-23 21:33:08 +02:00
|
|
|
- id: update-in-the-wild-to-be-sorted
|
2020-10-18 18:15:53 +01:00
|
|
|
name: Sort INTHEWILD.md alphabetically
|
2022-09-03 15:03:57 +02:00
|
|
|
entry: ./scripts/ci/pre_commit/pre_commit_sort_in_the_wild.py
|
|
|
|
|
language: python
|
2021-05-06 12:36:32 +10:00
|
|
|
files: ^\.pre-commit-config\.yaml$|^INTHEWILD\.md$
|
2022-09-03 15:03:57 +02:00
|
|
|
pass_filenames: false
|
2020-10-18 18:15:53 +01:00
|
|
|
require_serial: true
|
2023-01-30 02:37:50 +10:00
|
|
|
- id: update-installed-providers-to-be-sorted
|
|
|
|
|
name: Sort alphabetically and uniquify installed_providers.txt
|
|
|
|
|
entry: ./scripts/ci/pre_commit/pre_commit_sort_installed_providers.py
|
|
|
|
|
language: python
|
2023-10-20 15:48:21 +02:00
|
|
|
files: ^\.pre-commit-config\.yaml$|^airflow/providers/installed_providers\.txt$
|
2023-01-30 02:37:50 +10:00
|
|
|
pass_filenames: false
|
|
|
|
|
require_serial: true
|
2022-04-23 21:33:08 +02:00
|
|
|
- id: update-spelling-wordlist-to-be-sorted
|
2021-03-01 02:26:13 +10:00
|
|
|
name: Sort alphabetically and uniquify spelling_wordlist.txt
|
2022-09-04 11:15:07 +02:00
|
|
|
entry: ./scripts/ci/pre_commit/pre_commit_sort_spelling_wordlist.py
|
|
|
|
|
language: python
|
2021-05-06 12:36:32 +10:00
|
|
|
files: ^\.pre-commit-config\.yaml$|^docs/spelling_wordlist\.txt$
|
2021-03-01 02:26:13 +10:00
|
|
|
require_serial: true
|
2022-09-04 11:15:07 +02:00
|
|
|
pass_filenames: false
|
2022-04-23 21:33:08 +02:00
|
|
|
- id: lint-helm-chart
|
2020-10-18 18:15:53 +01:00
|
|
|
name: Lint Helm Chart
|
2022-09-02 23:20:45 +02:00
|
|
|
entry: ./scripts/ci/pre_commit/pre_commit_helm_lint.py
|
|
|
|
|
language: python
|
2020-10-18 18:15:53 +01:00
|
|
|
pass_filenames: false
|
|
|
|
|
files: ^chart
|
|
|
|
|
require_serial: true
|
2022-09-02 23:20:45 +02:00
|
|
|
additional_dependencies: ['rich>=12.4.4','requests']
|
2023-04-13 00:03:58 +08:00
|
|
|
- id: shellcheck
|
2020-10-18 18:15:53 +01:00
|
|
|
name: Check Shell scripts syntax correctness
|
|
|
|
|
language: docker_image
|
2022-05-04 00:37:30 +02:00
|
|
|
entry: koalaman/shellcheck:v0.8.0 -x -a
|
2023-02-13 01:04:11 +10:00
|
|
|
files: \.(bash|sh)$|^hooks/build$|^hooks/push$
|
2022-04-03 20:52:48 +02:00
|
|
|
exclude: ^dev/breeze/autocomplete/.*$
|
2022-04-23 21:33:08 +02:00
|
|
|
- id: lint-css
|
2020-10-20 09:21:28 +02:00
|
|
|
name: stylelint
|
|
|
|
|
entry: "stylelint"
|
|
|
|
|
language: node
|
2023-02-13 01:04:11 +10:00
|
|
|
files: ^airflow/www/.*\.(css|sass|scss)$
|
2020-10-20 09:21:28 +02:00
|
|
|
# Keep dependency versions in sync w/ airflow/www/package.json
|
2023-02-27 21:06:43 +01:00
|
|
|
additional_dependencies: ['stylelint@13.3.1', 'stylelint-config-standard@20.0.0', 'stylelint-config-prettier@9.0.5']
|
2022-07-20 19:30:03 +02:00
|
|
|
- id: compile-www-assets
|
|
|
|
|
name: Compile www assets
|
|
|
|
|
language: node
|
|
|
|
|
stages: ['manual']
|
2023-02-13 01:04:11 +10:00
|
|
|
'types_or': [javascript, ts, tsx]
|
2022-07-20 19:30:03 +02:00
|
|
|
files: ^airflow/www/
|
|
|
|
|
entry: ./scripts/ci/pre_commit/pre_commit_compile_www_assets.py
|
|
|
|
|
pass_filenames: false
|
|
|
|
|
additional_dependencies: ['yarn@1.22.19']
|
2022-07-25 23:37:22 +02:00
|
|
|
- id: compile-www-assets-dev
|
|
|
|
|
name: Compile www assets in dev mode
|
|
|
|
|
language: node
|
|
|
|
|
stages: ['manual']
|
2023-02-13 01:04:11 +10:00
|
|
|
'types_or': [javascript, ts, tsx]
|
2022-07-25 23:37:22 +02:00
|
|
|
files: ^airflow/www/
|
|
|
|
|
entry: ./scripts/ci/pre_commit/pre_commit_compile_www_assets_dev.py
|
|
|
|
|
pass_filenames: false
|
|
|
|
|
additional_dependencies: ['yarn@1.22.19']
|
2022-04-23 21:33:08 +02:00
|
|
|
- id: check-providers-init-file-missing
|
2021-09-10 16:08:32 +02:00
|
|
|
name: Provider init file is missing
|
2020-11-09 13:27:10 +01:00
|
|
|
pass_filenames: false
|
|
|
|
|
always_run: true
|
2022-09-02 13:49:07 +02:00
|
|
|
entry: ./scripts/ci/pre_commit/pre_commit_check_providers_init.py
|
|
|
|
|
language: python
|
2022-04-23 21:33:08 +02:00
|
|
|
- id: check-providers-subpackages-init-file-exist
|
2021-09-10 16:08:32 +02:00
|
|
|
name: Provider subpackage init files are there
|
2021-09-08 04:50:15 -04:00
|
|
|
pass_filenames: false
|
|
|
|
|
always_run: true
|
2021-09-10 16:08:32 +02:00
|
|
|
entry: ./scripts/ci/pre_commit/pre_commit_check_providers_subpackages_all_have_init.py
|
2021-09-08 04:50:15 -04:00
|
|
|
language: python
|
|
|
|
|
require_serial: true
|
2022-04-23 21:33:08 +02:00
|
|
|
- id: check-pre-commit-information-consistent
|
2023-05-24 11:21:52 -07:00
|
|
|
name: Validate hook IDs & names and sync with docs
|
2022-04-23 21:33:08 +02:00
|
|
|
entry: ./scripts/ci/pre_commit/pre_commit_check_pre_commit_hooks.py
|
2020-12-26 02:24:27 -08:00
|
|
|
args:
|
2023-05-24 11:21:52 -07:00
|
|
|
- --max-length=60
|
2020-12-26 02:24:27 -08:00
|
|
|
language: python
|
2022-02-28 05:00:28 +10:00
|
|
|
files: ^\.pre-commit-config\.yaml$|^scripts/ci/pre_commit/pre_commit_check_pre_commit_hook_names\.py$
|
2023-10-18 21:28:24 +02:00
|
|
|
additional_dependencies: ['pyyaml', 'jinja2', 'black==23.10.0', 'tabulate', 'rich>=12.4.4']
|
2020-12-26 02:24:27 -08:00
|
|
|
require_serial: true
|
|
|
|
|
pass_filenames: false
|
2022-04-23 21:33:08 +02:00
|
|
|
- id: update-breeze-readme-config-hash
|
2022-04-06 22:01:58 +02:00
|
|
|
name: Update Breeze README.md with config files hash
|
|
|
|
|
language: python
|
|
|
|
|
entry: ./scripts/ci/pre_commit/pre_commit_update_breeze_config_hash.py
|
2023-02-13 01:04:11 +10:00
|
|
|
files: ^dev/breeze/pyproject\.toml$|^dev/breeze/setup\.cfg$|^dev/breeze/setup\.py$|^dev/breeze/README\.md$
|
2022-04-06 22:01:58 +02:00
|
|
|
pass_filenames: false
|
|
|
|
|
require_serial: true
|
2022-04-23 21:33:08 +02:00
|
|
|
- id: check-breeze-top-dependencies-limited
|
2022-04-10 20:47:29 +02:00
|
|
|
name: Breeze should have small number of top-level dependencies
|
|
|
|
|
language: python
|
|
|
|
|
entry: ./scripts/tools/check_if_limited_dependencies.py
|
|
|
|
|
files: ^dev/breeze/.*$
|
|
|
|
|
pass_filenames: false
|
|
|
|
|
require_serial: true
|
2023-04-04 23:00:08 +02:00
|
|
|
additional_dependencies: ['click', 'rich>=12.4.4', 'pyyaml']
|
2022-04-23 21:33:08 +02:00
|
|
|
- id: check-system-tests-present
|
2022-03-25 14:46:14 +01:00
|
|
|
name: Check if system tests have required segments of code
|
|
|
|
|
entry: ./scripts/ci/pre_commit/pre_commit_check_system_tests.py
|
|
|
|
|
language: python
|
2023-02-13 01:04:11 +10:00
|
|
|
files: ^tests/system/.*/example_[^/]*\.py$
|
2022-06-13 19:38:20 +02:00
|
|
|
exclude: ^tests/system/providers/google/cloud/bigquery/example_bigquery_queries\.py$
|
2022-03-25 14:46:14 +01:00
|
|
|
pass_filenames: true
|
2022-06-04 20:43:44 +02:00
|
|
|
additional_dependencies: ['rich>=12.4.4']
|
2023-09-01 18:59:57 +05:30
|
|
|
- id: generate-pypi-readme
|
|
|
|
|
name: Generate PyPI README
|
|
|
|
|
entry: ./scripts/ci/pre_commit/pre_commit_generate_pypi_readme.py
|
|
|
|
|
language: python
|
|
|
|
|
files: ^README\.md$
|
|
|
|
|
pass_filenames: false
|
2022-04-23 21:33:08 +02:00
|
|
|
- id: lint-markdown
|
2020-11-14 12:23:23 +01:00
|
|
|
name: Run markdownlint
|
2021-05-06 12:36:32 +10:00
|
|
|
description: Checks the style of Markdown files.
|
2020-11-14 12:23:23 +01:00
|
|
|
entry: markdownlint
|
|
|
|
|
language: node
|
|
|
|
|
types: [markdown]
|
|
|
|
|
files: \.(md|mdown|markdown)$
|
|
|
|
|
additional_dependencies: ['markdownlint-cli']
|
2022-04-23 21:33:08 +02:00
|
|
|
- id: lint-json-schema
|
2020-11-28 12:12:54 +01:00
|
|
|
name: Lint JSON Schema files with JSON Schema
|
|
|
|
|
entry: ./scripts/ci/pre_commit/pre_commit_json_schema.py
|
|
|
|
|
args:
|
|
|
|
|
- --spec-url
|
|
|
|
|
- https://json-schema.org/draft-07/schema
|
|
|
|
|
language: python
|
|
|
|
|
pass_filenames: true
|
2021-01-11 23:10:44 +01:00
|
|
|
files: .*\.schema\.json$
|
2023-04-08 18:41:41 +02:00
|
|
|
exclude: ^.*/.*_vendor/
|
2020-11-28 12:12:54 +01:00
|
|
|
require_serial: true
|
2022-02-21 16:29:45 +01:00
|
|
|
additional_dependencies: ['jsonschema>=3.2.0,<5.0', 'PyYAML==5.3.1', 'requests==2.25.0']
|
2022-04-23 21:33:08 +02:00
|
|
|
- id: lint-json-schema
|
2021-05-17 16:25:05 -06:00
|
|
|
name: Lint NodePort Service with JSON Schema
|
2020-12-04 16:51:59 +01:00
|
|
|
entry: ./scripts/ci/pre_commit/pre_commit_json_schema.py
|
|
|
|
|
args:
|
|
|
|
|
- --spec-url
|
2021-11-24 23:29:46 +01:00
|
|
|
- https://raw.githubusercontent.com/yannh/kubernetes-json-schema/master/v1.20.2-standalone/service-v1.json
|
2020-12-04 16:51:59 +01:00
|
|
|
language: python
|
|
|
|
|
pass_filenames: true
|
2022-03-08 09:00:46 +10:00
|
|
|
files: ^scripts/ci/kubernetes/nodeport\.yaml$
|
2020-12-04 16:51:59 +01:00
|
|
|
require_serial: true
|
2022-02-21 16:29:45 +01:00
|
|
|
additional_dependencies: ['jsonschema>=3.2.0,<5.0', 'PyYAML==5.3.1', 'requests==2.25.0']
|
2022-04-23 21:33:08 +02:00
|
|
|
- id: lint-json-schema
|
2020-12-04 16:51:59 +01:00
|
|
|
name: Lint Docker compose files with JSON Schema
|
|
|
|
|
entry: ./scripts/ci/pre_commit/pre_commit_json_schema.py
|
|
|
|
|
args:
|
|
|
|
|
- --spec-url
|
|
|
|
|
- https://raw.githubusercontent.com/compose-spec/compose-spec/master/schema/compose-spec.json
|
|
|
|
|
language: python
|
|
|
|
|
pass_filenames: true
|
2021-05-06 12:36:32 +10:00
|
|
|
files: ^scripts/ci/docker-compose/.+\.ya?ml$|docker-compose\.ya?ml$
|
2023-02-15 09:34:31 -08:00
|
|
|
exclude: >
|
|
|
|
|
(?x)
|
|
|
|
|
^scripts/ci/docker-compose/grafana/.|
|
|
|
|
|
^scripts/ci/docker-compose/.+-config\.ya?ml
|
2020-12-04 16:51:59 +01:00
|
|
|
require_serial: true
|
2022-02-21 16:29:45 +01:00
|
|
|
additional_dependencies: ['jsonschema>=3.2.0,<5.0', 'PyYAML==5.3.1', 'requests==2.25.0']
|
2022-04-23 21:33:08 +02:00
|
|
|
- id: lint-json-schema
|
2021-05-13 14:58:04 -06:00
|
|
|
name: Lint chart/values.schema.json file with JSON Schema
|
|
|
|
|
entry: ./scripts/ci/pre_commit/pre_commit_json_schema.py
|
|
|
|
|
args:
|
|
|
|
|
- --spec-file
|
|
|
|
|
- chart/values_schema.schema.json
|
2021-05-17 15:44:17 -06:00
|
|
|
- chart/values.schema.json
|
2021-05-13 14:58:04 -06:00
|
|
|
language: python
|
2021-05-17 15:44:17 -06:00
|
|
|
pass_filenames: false
|
|
|
|
|
files: ^chart/values\.schema\.json$|^chart/values_schema\.schema\.json$
|
2021-05-13 14:58:04 -06:00
|
|
|
require_serial: true
|
2022-02-21 16:29:45 +01:00
|
|
|
additional_dependencies: ['jsonschema>=3.2.0,<5.0', 'PyYAML==5.3.1', 'requests==2.25.0']
|
2022-04-23 21:33:08 +02:00
|
|
|
- id: update-vendored-in-k8s-json-schema
|
2021-12-29 12:29:07 -07:00
|
|
|
name: Vendor k8s definitions into values.schema.json
|
|
|
|
|
entry: ./scripts/ci/pre_commit/pre_commit_vendor_k8s_json_schema.py
|
|
|
|
|
language: python
|
|
|
|
|
files: ^chart/values\.schema\.json$
|
|
|
|
|
additional_dependencies: ['requests==2.25.0']
|
2022-04-23 21:33:08 +02:00
|
|
|
- id: lint-json-schema
|
2020-12-04 16:51:59 +01:00
|
|
|
name: Lint chart/values.yaml file with JSON Schema
|
|
|
|
|
entry: ./scripts/ci/pre_commit/pre_commit_json_schema.py
|
|
|
|
|
args:
|
2021-05-13 14:58:04 -06:00
|
|
|
- --enforce-defaults
|
2020-12-04 16:51:59 +01:00
|
|
|
- --spec-file
|
|
|
|
|
- chart/values.schema.json
|
2021-05-17 15:44:17 -06:00
|
|
|
- chart/values.yaml
|
2020-12-04 16:51:59 +01:00
|
|
|
language: python
|
2021-05-17 15:44:17 -06:00
|
|
|
pass_filenames: false
|
|
|
|
|
files: ^chart/values\.yaml$|^chart/values\.schema\.json$
|
2020-12-04 16:51:59 +01:00
|
|
|
require_serial: true
|
2022-02-21 16:29:45 +01:00
|
|
|
additional_dependencies: ['jsonschema>=3.2.0,<5.0', 'PyYAML==5.3.1', 'requests==2.25.0']
|
2022-04-23 21:33:08 +02:00
|
|
|
- id: lint-json-schema
|
2023-05-24 11:21:52 -07:00
|
|
|
name: Lint config_templates/config.yml file with JSON Schema
|
2020-12-15 20:49:06 -05:00
|
|
|
entry: ./scripts/ci/pre_commit/pre_commit_json_schema.py
|
|
|
|
|
args:
|
|
|
|
|
- --spec-file
|
|
|
|
|
- airflow/config_templates/config.yml.schema.json
|
|
|
|
|
language: python
|
|
|
|
|
pass_filenames: true
|
2022-03-08 09:00:46 +10:00
|
|
|
files: ^airflow/config_templates/config\.yml$
|
2020-12-15 20:49:06 -05:00
|
|
|
require_serial: true
|
2022-02-21 16:29:45 +01:00
|
|
|
additional_dependencies: ['jsonschema>=3.2.0,<5.0', 'PyYAML==5.3.1', 'requests==2.25.0']
|
2022-04-23 21:33:08 +02:00
|
|
|
- id: check-persist-credentials-disabled-in-github-workflows
|
2021-12-20 22:22:54 +01:00
|
|
|
name: Check that workflow files have persist-credentials disabled
|
|
|
|
|
entry: ./scripts/ci/pre_commit/pre_commit_checkout_no_credentials.py
|
|
|
|
|
language: python
|
|
|
|
|
pass_filenames: true
|
2022-03-08 09:00:46 +10:00
|
|
|
files: ^\.github/workflows/.*\.yml$
|
2022-06-04 20:43:44 +02:00
|
|
|
additional_dependencies: ['PyYAML', 'rich>=12.4.4']
|
2022-04-23 21:33:08 +02:00
|
|
|
- id: check-docstring-param-types
|
2022-02-08 15:07:54 -08:00
|
|
|
name: Check that docstrings do not specify param types
|
|
|
|
|
entry: ./scripts/ci/pre_commit/pre_commit_docstring_param_type.py
|
|
|
|
|
language: python
|
|
|
|
|
pass_filenames: true
|
|
|
|
|
files: \.py$
|
2023-04-08 18:41:41 +02:00
|
|
|
exclude: ^.*/.*_vendor/
|
2022-06-04 20:43:44 +02:00
|
|
|
additional_dependencies: ['rich>=12.4.4']
|
2022-04-23 21:33:08 +02:00
|
|
|
- id: lint-chart-schema
|
2021-12-13 22:49:12 +01:00
|
|
|
name: Lint chart/values.schema.json file
|
|
|
|
|
entry: ./scripts/ci/pre_commit/pre_commit_chart_schema.py
|
|
|
|
|
language: python
|
|
|
|
|
pass_filenames: false
|
|
|
|
|
files: ^chart/values\.schema\.json$
|
|
|
|
|
require_serial: true
|
2022-04-23 21:33:08 +02:00
|
|
|
- id: update-inlined-dockerfile-scripts
|
2022-03-27 19:19:02 +02:00
|
|
|
name: Inline Dockerfile and Dockerfile.ci scripts
|
|
|
|
|
entry: ./scripts/ci/pre_commit/pre_commit_inline_scripts_in_docker.py
|
|
|
|
|
language: python
|
|
|
|
|
pass_filenames: false
|
2023-01-30 05:26:45 +10:00
|
|
|
files: ^Dockerfile$|^Dockerfile\.ci$|^scripts/docker/.*$
|
2022-03-27 19:19:02 +02:00
|
|
|
require_serial: true
|
2022-04-23 21:33:08 +02:00
|
|
|
- id: check-changelog-has-no-duplicates
|
2021-11-23 12:35:17 -07:00
|
|
|
name: Check changelogs for duplicate entries
|
|
|
|
|
language: python
|
2023-02-13 01:04:11 +10:00
|
|
|
files: CHANGELOG\.(rst|txt)$
|
2022-03-08 09:00:46 +10:00
|
|
|
entry: ./scripts/ci/pre_commit/pre_commit_changelog_duplicates.py
|
2021-11-23 12:35:17 -07:00
|
|
|
pass_filenames: true
|
2022-04-23 21:33:08 +02:00
|
|
|
- id: check-newsfragments-are-valid
|
2022-04-20 09:30:08 -06:00
|
|
|
name: Check newsfragments are valid
|
|
|
|
|
language: python
|
|
|
|
|
files: newsfragments/.*\.rst
|
|
|
|
|
entry: ./scripts/ci/pre_commit/pre_commit_newsfragments.py
|
|
|
|
|
pass_filenames: true
|
2022-10-03 09:47:36 -05:00
|
|
|
# We sometimes won't have newsfragments in the repo, so always run it so `check-hooks-apply` passes
|
|
|
|
|
# This is fast, so not too much downside
|
|
|
|
|
always_run: true
|
2022-09-18 12:47:38 +02:00
|
|
|
- id: update-breeze-cmd-output
|
|
|
|
|
name: Update output of breeze commands in BREEZE.rst
|
|
|
|
|
entry: ./scripts/ci/pre_commit/pre_commit_breeze_cmd_line.py
|
|
|
|
|
language: python
|
2023-04-04 23:00:08 +02:00
|
|
|
files: >
|
|
|
|
|
(?x)
|
|
|
|
|
^BREEZE\.rst$|^dev/breeze/.*$|
|
|
|
|
|
^\.pre-commit-config\.yaml$|
|
|
|
|
|
^scripts/ci/pre_commit/pre_commit_breeze_cmd_line.py$|
|
|
|
|
|
^generated/provider_dependencies.json$
|
2022-10-03 09:47:36 -05:00
|
|
|
require_serial: true
|
2022-09-18 12:47:38 +02:00
|
|
|
pass_filenames: false
|
2023-10-14 20:42:57 +02:00
|
|
|
additional_dependencies: ['rich>=12.4.4', 'rich-click>=1.7.0', 'inputimeout', 'pyyaml', 'packaging']
|
2022-06-09 00:56:47 +02:00
|
|
|
- id: check-example-dags-urls
|
|
|
|
|
name: Check that example dags url include provider versions
|
|
|
|
|
entry: ./scripts/ci/pre_commit/pre_commit_update_example_dags_paths.py
|
|
|
|
|
language: python
|
|
|
|
|
pass_filenames: true
|
2023-02-13 01:04:11 +10:00
|
|
|
files: ^docs/.*example-dags\.rst$|^docs/.*index\.rst$
|
2022-06-09 00:56:47 +02:00
|
|
|
additional_dependencies: ['rich>=12.4.4', 'pyyaml']
|
2022-06-13 19:38:20 +02:00
|
|
|
always_run: true
|
|
|
|
|
- id: check-system-tests-tocs
|
|
|
|
|
name: Check that system tests is properly added
|
|
|
|
|
entry: ./scripts/ci/pre_commit/pre_commit_check_system_tests_hidden_in_index.py
|
|
|
|
|
language: python
|
|
|
|
|
pass_filenames: true
|
|
|
|
|
files: ^docs/apache-airflow-providers-[^/]*/index\.rst$
|
|
|
|
|
additional_dependencies: ['rich>=12.4.4', 'pyyaml']
|
2022-07-08 13:02:28 +02:00
|
|
|
- id: check-lazy-logging
|
|
|
|
|
name: Check that all logging methods are lazy
|
|
|
|
|
entry: ./scripts/ci/pre_commit/pre_commit_check_lazy_logging.py
|
|
|
|
|
language: python
|
|
|
|
|
pass_filenames: true
|
|
|
|
|
files: \.py$
|
2023-04-08 18:41:41 +02:00
|
|
|
exclude: ^.*/.*_vendor/
|
2022-07-08 13:02:28 +02:00
|
|
|
additional_dependencies: ['rich>=12.4.4', 'astor']
|
2022-06-13 19:38:20 +02:00
|
|
|
- id: create-missing-init-py-files-tests
|
|
|
|
|
name: Create missing init.py files in tests
|
|
|
|
|
entry: ./scripts/ci/pre_commit/pre_commit_check_init_in_tests.py
|
|
|
|
|
language: python
|
|
|
|
|
additional_dependencies: ['rich>=12.4.4']
|
|
|
|
|
pass_filenames: false
|
|
|
|
|
files: ^tests/.*\.py$
|
2023-02-27 21:06:43 +01:00
|
|
|
- id: ts-compile-format-lint-www
|
2023-05-24 11:21:52 -07:00
|
|
|
name: TS types generation / ESLint / Prettier against UI files
|
2022-07-20 19:30:03 +02:00
|
|
|
language: node
|
2023-02-27 21:06:43 +01:00
|
|
|
'types_or': [javascript, ts, tsx, yaml, css, json]
|
2023-02-13 01:04:11 +10:00
|
|
|
files: ^airflow/www/static/js/|^airflow/api_connexion/openapi/v1\.yaml$
|
2022-07-20 19:30:03 +02:00
|
|
|
entry: ./scripts/ci/pre_commit/pre_commit_www_lint.py
|
|
|
|
|
additional_dependencies: ['yarn@1.22.19']
|
|
|
|
|
pass_filenames: false
|
2023-05-01 18:42:47 -04:00
|
|
|
- id: check-tests-unittest-testcase
|
|
|
|
|
name: Check that unit tests do not inherit from unittest.TestCase
|
|
|
|
|
entry: ./scripts/ci/pre_commit/pre_commit_unittest_testcase.py
|
|
|
|
|
language: python
|
|
|
|
|
pass_filenames: true
|
|
|
|
|
files: ^tests/.*\.py$
|
2023-07-06 19:58:54 +02:00
|
|
|
- id: check-usage-of-re2-over-re
|
|
|
|
|
language: pygrep
|
2023-07-07 13:54:47 +02:00
|
|
|
name: Use re2 module instead of re
|
2023-07-06 19:58:54 +02:00
|
|
|
description: Use re2 module instead of re
|
|
|
|
|
entry: "^\\s*from re\\s|^\\s*import re\\s"
|
|
|
|
|
pass_filenames: true
|
|
|
|
|
files: \.py$
|
2023-07-07 13:54:47 +02:00
|
|
|
exclude: ^airflow/providers|^dev/.*\.py$|^scripts/.*\.py$|^tests/|^\w+_tests/|^docs/.*\.py$|^airflow/utils/helpers.py$
|
2023-07-07 18:33:25 +08:00
|
|
|
- id: check-deferrable-default-value
|
|
|
|
|
name: Check default value of deferrable attribute
|
|
|
|
|
language: python
|
|
|
|
|
entry: ./scripts/ci/pre_commit/pre_commit_check_deferrable_default.py
|
|
|
|
|
pass_filenames: false
|
|
|
|
|
files: ^airflow/.*/sensors/.*\.py$|^airflow/.*/operators/.*\.py$
|
2023-11-04 14:01:51 +01:00
|
|
|
- id: check-provider-docs-valid
|
|
|
|
|
name: Validate provider doc files
|
|
|
|
|
entry: ./scripts/ci/pre_commit/pre_commit_check_provider_docs.py
|
|
|
|
|
language: python
|
|
|
|
|
files: ^airflow/providers/.*/provider\.yaml|^docs/.*
|
|
|
|
|
additional_dependencies: ['rich>=12.4.4', 'pyyaml', 'jinja2']
|
|
|
|
|
require_serial: true
|
2020-11-14 12:23:23 +01:00
|
|
|
## ADD MOST PRE-COMMITS ABOVE THAT LINE
|
|
|
|
|
# The below pre-commits are those requiring CI image to be built
|
2023-04-13 00:03:58 +08:00
|
|
|
- id: mypy-dev
|
2022-04-20 00:15:46 +02:00
|
|
|
name: Run mypy for dev
|
2022-04-23 09:12:11 +02:00
|
|
|
language: python
|
|
|
|
|
entry: ./scripts/ci/pre_commit/pre_commit_mypy.py
|
2022-04-20 00:15:46 +02:00
|
|
|
files: ^dev/.*\.py$
|
|
|
|
|
require_serial: true
|
2023-04-04 23:00:08 +02:00
|
|
|
additional_dependencies: ['rich>=12.4.4', 'inputimeout', 'pyyaml']
|
2023-04-13 00:03:58 +08:00
|
|
|
- id: mypy-core
|
2022-04-19 21:12:06 +02:00
|
|
|
name: Run mypy for core
|
2022-04-23 09:12:11 +02:00
|
|
|
language: python
|
|
|
|
|
entry: ./scripts/ci/pre_commit/pre_commit_mypy.py --namespace-packages
|
2019-08-14 20:53:28 -04:00
|
|
|
files: \.py$
|
2023-04-14 10:22:19 -07:00
|
|
|
exclude: ^.*/.*_vendor/|^airflow/migrations|^airflow/providers|^dev|^docs|^provider_packages|^tests/providers|^tests/system/providers|^tests/dags/test_imports.py
|
2022-04-19 21:12:06 +02:00
|
|
|
require_serial: true
|
2023-04-04 23:00:08 +02:00
|
|
|
additional_dependencies: ['rich>=12.4.4', 'inputimeout', 'pyyaml']
|
2023-04-13 00:03:58 +08:00
|
|
|
- id: mypy-providers
|
2022-04-19 21:12:06 +02:00
|
|
|
name: Run mypy for providers
|
2022-04-23 09:12:11 +02:00
|
|
|
language: python
|
|
|
|
|
entry: ./scripts/ci/pre_commit/pre_commit_mypy.py --namespace-packages
|
2023-11-06 19:40:52 +01:00
|
|
|
files: ^airflow/providers/.*\.py$|^tests/providers/.*\.py$|^tests/system/providers/.*\.py$
|
2023-04-08 18:41:41 +02:00
|
|
|
exclude: ^.*/.*_vendor/
|
2021-12-01 00:23:50 +01:00
|
|
|
require_serial: true
|
2023-04-04 23:00:08 +02:00
|
|
|
additional_dependencies: ['rich>=12.4.4', 'inputimeout', 'pyyaml']
|
2023-04-13 00:03:58 +08:00
|
|
|
- id: mypy-docs
|
2020-11-15 00:50:30 +01:00
|
|
|
name: Run mypy for /docs/ folder
|
2022-04-23 09:12:11 +02:00
|
|
|
language: python
|
|
|
|
|
entry: ./scripts/ci/pre_commit/pre_commit_mypy.py
|
2020-11-15 00:50:30 +01:00
|
|
|
files: ^docs/.*\.py$
|
2022-04-01 18:41:44 +10:00
|
|
|
exclude: ^docs/rtd-deprecation
|
2021-12-01 00:23:50 +01:00
|
|
|
require_serial: true
|
2023-04-04 23:00:08 +02:00
|
|
|
additional_dependencies: ['rich>=12.4.4', 'inputimeout', 'pyyaml']
|
2022-12-22 03:25:08 +01:00
|
|
|
- id: check-provider-yaml-valid
|
|
|
|
|
name: Validate provider.yaml files
|
|
|
|
|
entry: ./scripts/ci/pre_commit/pre_commit_check_provider_yaml_files.py
|
|
|
|
|
language: python
|
2023-02-13 01:04:11 +10:00
|
|
|
files: ^airflow/providers/.*/provider\.yaml$
|
2022-12-22 03:25:08 +01:00
|
|
|
additional_dependencies: ['rich>=12.4.4', 'inputimeout', 'markdown-it-py']
|
2022-12-28 19:38:00 +01:00
|
|
|
require_serial: true
|
2022-04-23 21:33:08 +02:00
|
|
|
- id: update-migration-references
|
2022-02-28 23:25:02 -08:00
|
|
|
name: Update migration ref doc
|
2022-04-23 09:12:11 +02:00
|
|
|
language: python
|
|
|
|
|
entry: ./scripts/ci/pre_commit/pre_commit_migration_reference.py
|
2022-02-28 23:25:02 -08:00
|
|
|
pass_filenames: false
|
2022-04-01 18:41:44 +10:00
|
|
|
files: ^airflow/migrations/versions/.*\.py$|^docs/apache-airflow/migrations-ref\.rst$
|
2022-06-29 18:38:29 +02:00
|
|
|
additional_dependencies: ['rich>=12.4.4', 'inputimeout', 'markdown-it-py']
|
2022-09-08 10:39:13 +02:00
|
|
|
- id: update-er-diagram
|
|
|
|
|
name: Update ER diagram
|
|
|
|
|
language: python
|
|
|
|
|
entry: ./scripts/ci/pre_commit/pre_commit_update_er_diagram.py
|
|
|
|
|
pass_filenames: false
|
|
|
|
|
files: ^airflow/migrations/versions/.*\.py$|^docs/apache-airflow/migrations-ref\.rst$
|
|
|
|
|
additional_dependencies: ['rich>=12.4.4']
|
2020-11-14 12:23:23 +01:00
|
|
|
## ONLY ADD PRE-COMMITS HERE THAT REQUIRE CI IMAGE
|