Skip to content

Commit

Permalink
Reduce max length of pre-commit hooks (#42384)
Browse files Browse the repository at this point in the history
This is just to ensure that we get each hook on a single line when running in split pane on macbook pro 14".
  • Loading branch information
dstandish authored Sep 20, 2024
1 parent 0f64f32 commit c946846
Show file tree
Hide file tree
Showing 3 changed files with 325 additions and 314 deletions.
73 changes: 42 additions & 31 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ repos:
- repo: meta
hooks:
- id: identity
name: Print input to the static check hooks for troubleshooting
name: Print checked files
description: Print input to the static check hooks for troubleshooting
- id: check-hooks-apply
name: Check if all hooks apply to the repository
- repo: https://github.com/thlorenz/doctoc.git
Expand Down Expand Up @@ -65,7 +66,7 @@ repos:
- --fuzzy-match-generates-todo
files: \.rst$
- id: insert-license
name: Add license for all CSS/JS/JSX/PUML/TS/TSX files
name: Add license for CSS/JS/JSX/PUML/TS/TSX
files: \.(css|jsx?|puml|tsx?)$
exclude: ^\.github/.*$|^.*/.*_vendor/|^airflow/www/static/js/types/api-generated.ts$|ui/openapi-gen/
args:
Expand Down Expand Up @@ -229,7 +230,7 @@ repos:
rev: 1.18.0
hooks:
- id: blacken-docs
name: Run black on Python code blocks in documentation files
name: Run black on docs
args:
- --line-length=110
- --target-version=py37
Expand All @@ -246,7 +247,7 @@ repos:
- id: debug-statements
name: Detect accidentally committed debug statements
- id: check-builtin-literals
name: Require literal syntax when initializing builtin types
name: Require literal syntax when initializing builtins
exclude: ^.*/.*_vendor/
- id: detect-private-key
name: Detect if private key is added to the repository
Expand Down Expand Up @@ -315,7 +316,8 @@ repos:
rev: v2.3.0
hooks:
- id: codespell
name: Run codespell to check for common misspellings in files
name: Run codespell
description: Run codespell to check for common misspellings in files
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 "$@"' --
Expand All @@ -336,7 +338,8 @@ repos:
# to be applied before the non-local pre-commits are run
hooks:
- id: validate-operators-init
name: Prevent templated field logic checks in operators' __init__
name: No templated field logic checks in operator __init__
description: Prevent templated field logic checks in operators' __init__
language: python
entry: ./scripts/ci/pre_commit/validate_operators_init.py
pass_filenames: true
Expand All @@ -353,7 +356,7 @@ repos:
additional_dependencies: ["ruff==0.5.5"]
exclude: ^.*/.*_vendor/|^tests/dags/test_imports.py|^performance/tests/test_.*.py
- id: ruff-format
name: Run 'ruff format' for extremely fast Python formatting
name: Run 'ruff format'
description: "Run 'ruff format' for extremely fast Python formatting"
entry: ./scripts/ci/pre_commit/ruff_format.py
language: python
Expand Down Expand Up @@ -404,7 +407,7 @@ repos:
entry: ./scripts/ci/pre_commit/check_common_compat_used_for_openlineage.py
additional_dependencies: ['rich>=12.4.4']
- id: check-airflow-providers-bug-report-template
name: Check airflow-bug-report provider list is sorted/unique
name: Sort airflow-bug-report provider list
language: python
files: ^.github/ISSUE_TEMPLATE/airflow_providers_bug_report\.yml$
require_serial: true
Expand All @@ -426,7 +429,8 @@ repos:
files: ^airflow/providers/.*\.py$
additional_dependencies: ['rich>=12.4.4']
- id: check-google-re2-as-dependency
name: Check google-re2 is declared as dependency when needed
name: Check google-re2 declared as dep
description: Check google-re2 is declared as dependency when needed
entry: ./scripts/ci/pre_commit/check_google_re2_imports.py
language: python
pass_filenames: true
Expand All @@ -441,7 +445,8 @@ repos:
pass_filenames: false
additional_dependencies: ['rich>=12.4.4']
- id: check-sql-dependency-common-data-structure
name: Check dependency of SQL Providers with common data structure
name: Check dependency of SQL providers
description: Check dependency of SQL Providers with common data structure
entry: ./scripts/ci/pre_commit/check_common_sql_dependency.py
language: python
files: ^airflow/providers/.*/hooks/.*\.py$
Expand Down Expand Up @@ -508,7 +513,7 @@ repos:
^airflow/utils/db.py$
additional_dependencies: ['packaging','google-re2']
- id: update-version
name: Update version to the latest version in the documentation
name: Update versions in docs
entry: ./scripts/ci/pre_commit/update_versions.py
language: python
files: ^docs|^airflow/__init__.py$
Expand All @@ -521,7 +526,7 @@ repos:
pass_filenames: true
files: \.py$
- id: check-links-to-example-dags-do-not-use-hardcoded-versions
name: Verify example dags do not use hard-coded version numbers
name: Verify no hard-coded version in example dags
description: The links to example dags should use |version| as version specification
language: pygrep
entry: >
Expand Down Expand Up @@ -661,13 +666,13 @@ repos:
pass_filenames: false
files: ^airflow/models/(?:base|mapped)operator\.py$
- id: check-init-decorator-arguments
name: Check model __init__ and decorator arguments are in sync
name: Sync model __init__ and decorator arguments
language: python
entry: ./scripts/ci/pre_commit/sync_init_decorator.py
pass_filenames: false
files: ^airflow/models/dag\.py$|^airflow/(?:decorators|utils)/task_group\.py$
- id: check-template-context-variable-in-sync
name: Check all template context variable references are in sync
name: Sync template context variable refs
language: python
entry: ./scripts/ci/pre_commit/template_context_key_sync.py
files: ^airflow/models/taskinstance\.py$|^airflow/utils/context\.pyi?$|^docs/apache-airflow/templates-ref\.rst$
Expand Down Expand Up @@ -751,14 +756,14 @@ repos:
pass_filenames: true
- id: check-daysago-import-from-utils
language: pygrep
name: Make sure days_ago is imported from airflow.utils.dates
name: days_ago imported from airflow.utils.dates
entry: "(airflow\\.){0,1}utils\\.dates\\.days_ago"
files: \.py$
exclude: ^.*/.*_vendor/
pass_filenames: true
- id: check-start-date-not-used-in-defaults
language: pygrep
name: start_date not to be defined in default_args in example_dags
name: start_date not in default_args
entry: "default_args\\s*=\\s*{\\s*(\"|')start_date(\"|')|(\"|')start_date(\"|'):"
files: \.*example_dags.*\.py$
exclude: ^.*/.*_vendor/
Expand Down Expand Up @@ -792,14 +797,14 @@ repos:
pass_filenames: false
require_serial: true
- id: update-installed-providers-to-be-sorted
name: Sort alphabetically and uniquify installed_providers.txt
name: Sort and uniquify installed_providers.txt
entry: ./scripts/ci/pre_commit/sort_installed_providers.py
language: python
files: ^\.pre-commit-config\.yaml$|^.*_installed_providers\.txt$
pass_filenames: false
require_serial: true
- id: update-spelling-wordlist-to-be-sorted
name: Sort alphabetically and uniquify spelling_wordlist.txt
name: Sort spelling_wordlist.txt
entry: ./scripts/ci/pre_commit/sort_spelling_wordlist.py
language: python
files: ^\.pre-commit-config\.yaml$|^docs/spelling_wordlist\.txt$
Expand Down Expand Up @@ -895,7 +900,7 @@ repos:
name: Validate hook IDs & names and sync with docs
entry: ./scripts/ci/pre_commit/check_pre_commit_hooks.py
args:
- --max-length=60
- --max-length=53
language: python
files: ^\.pre-commit-config\.yaml$|^scripts/ci/pre_commit/check_pre_commit_hooks\.py$
additional_dependencies: ['pyyaml', 'jinja2', 'black==23.10.0', 'tabulate', 'rich>=12.4.4']
Expand Down Expand Up @@ -925,7 +930,8 @@ repos:
pass_filenames: false
require_serial: true
- id: check-breeze-top-dependencies-limited
name: Breeze should have small number of top-level dependencies
name: Check top-level breeze deps
description: Breeze should have small number of top-level dependencies
language: python
entry: ./scripts/tools/check_if_limited_dependencies.py
files: ^dev/breeze/.*$
Expand Down Expand Up @@ -963,7 +969,7 @@ repos:
files: \.(md|mdown|markdown)$
additional_dependencies: ['markdownlint-cli@0.38.0']
- id: lint-json-schema
name: Lint JSON Schema files with JSON Schema
name: Lint JSON Schema files
entry: ./scripts/ci/pre_commit/json_schema.py
args:
- --spec-url
Expand All @@ -975,7 +981,7 @@ repos:
require_serial: true
additional_dependencies: ['jsonschema>=3.2.0,<5.0', 'PyYAML==5.3.1', 'requests==2.25.0']
- id: lint-json-schema
name: Lint NodePort Service with JSON Schema
name: Lint NodePort Service
entry: ./scripts/ci/pre_commit/json_schema.py
args:
- --spec-url
Expand All @@ -986,7 +992,7 @@ repos:
require_serial: true
additional_dependencies: ['jsonschema>=3.2.0,<5.0', 'PyYAML==5.3.1', 'requests==2.25.0']
- id: lint-json-schema
name: Lint Docker compose files with JSON Schema
name: Lint Docker compose files
entry: ./scripts/ci/pre_commit/json_schema.py
args:
- --spec-url
Expand All @@ -1001,7 +1007,7 @@ repos:
require_serial: true
additional_dependencies: ['jsonschema>=3.2.0,<5.0', 'PyYAML==5.3.1', 'requests==2.25.0']
- id: lint-json-schema
name: Lint chart/values.schema.json file with JSON Schema
name: Lint chart/values.schema.json
entry: ./scripts/ci/pre_commit/json_schema.py
args:
- --spec-file
Expand All @@ -1019,7 +1025,7 @@ repos:
files: ^chart/values\.schema\.json$
additional_dependencies: ['requests==2.25.0']
- id: lint-json-schema
name: Lint chart/values.yaml file with JSON Schema
name: Lint chart/values.yaml
entry: ./scripts/ci/pre_commit/json_schema.py
args:
- --enforce-defaults
Expand All @@ -1032,7 +1038,7 @@ repos:
require_serial: true
additional_dependencies: ['jsonschema>=3.2.0,<5.0', 'PyYAML==5.3.1', 'requests==2.25.0']
- id: lint-json-schema
name: Lint config_templates/config.yml file with JSON Schema
name: Lint config_templates/config.yml
entry: ./scripts/ci/pre_commit/json_schema.py
args:
- --spec-file
Expand All @@ -1043,7 +1049,8 @@ repos:
require_serial: true
additional_dependencies: ['jsonschema>=3.2.0,<5.0', 'PyYAML==5.3.1', 'requests==2.25.0']
- id: check-persist-credentials-disabled-in-github-workflows
name: Check that workflow files have persist-credentials disabled
name: Check persistent creds in workflow files
description: Check that workflow files have persist-credentials disabled
entry: ./scripts/ci/pre_commit/checkout_no_credentials.py
language: python
pass_filenames: true
Expand Down Expand Up @@ -1108,7 +1115,8 @@ repos:
# This is fast, so not too much downside
always_run: true
- id: update-breeze-cmd-output
name: Update output of breeze commands in Breeze documentation
name: Update breeze docs
description: Update output of breeze commands in Breeze documentation
entry: ./scripts/ci/pre_commit/breeze_cmd_line.py
language: python
files: >
Expand Down Expand Up @@ -1151,23 +1159,26 @@ repos:
pass_filenames: false
files: ^tests/.*\.py$
- id: ts-compile-format-lint-www
name: TS types generation / ESLint / Prettier against UI files
name: Compile / format / lint WWW
description: TS types generation / ESLint / Prettier against UI files
language: node
'types_or': [javascript, ts, tsx, yaml, css, json]
files: ^airflow/www/static/(js|css)/|^airflow/api_connexion/openapi/v1\.yaml$
entry: ./scripts/ci/pre_commit/lint_www.py
additional_dependencies: ['yarn@1.22.21', "openapi-typescript@>=6.7.4"]
pass_filenames: false
- id: ts-compile-format-lint-ui
name: TS types generation / ESLint / Prettier new UI files
name: Compile / format / lint UI
description: TS types generation / ESLint / Prettier new UI files
language: node
types_or: [javascript, ts, tsx, yaml, css, json]
files: ^airflow/ui/|^airflow/api_connexion/openapi/v1\.yaml$
entry: ./scripts/ci/pre_commit/lint_ui.py
additional_dependencies: ['pnpm@9.7.1']
pass_filenames: false
- id: check-tests-unittest-testcase
name: Check that unit tests do not inherit from unittest.TestCase
name: Unit tests do not inherit from unittest.TestCase
description: Check that unit tests do not inherit from unittest.TestCase
entry: ./scripts/ci/pre_commit/unittest_testcase.py
language: python
pass_filenames: true
Expand Down
Loading

0 comments on commit c946846

Please sign in to comment.