diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 8e3b2877895f9..9c0403302b7c7 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -223,6 +223,14 @@ repos: files: ^airflow/models/taskinstance.py$|^airflow/models/taskinstancehistory.py$ pass_filenames: false require_serial: true + - id: prevent-usage-of-session.query + name: Prevent usage of session.query in core airflow + entry: ./scripts/ci/pre_commit/usage_session_query.py + language: python + additional_dependencies: ['rich>=12.4.4'] + files: ^airflow.*\.py$ + exclude: ^airflow/tests/.*\.py$ + pass_filenames: true - id: check-deferrable-default name: Check and fix default value of default_deferrable language: python diff --git a/contributing-docs/08_static_code_checks.rst b/contributing-docs/08_static_code_checks.rst index 427f807be4529..fa547a0b71ca9 100644 --- a/contributing-docs/08_static_code_checks.rst +++ b/contributing-docs/08_static_code_checks.rst @@ -334,6 +334,8 @@ require Breeze Docker image to be built locally. +-----------------------------------------------------------+--------------------------------------------------------+---------+ | pretty-format-json | Format JSON files | | +-----------------------------------------------------------+--------------------------------------------------------+---------+ +| prevent-usage-of-session.query | Prevent usage of session.query in core airflow | | ++-----------------------------------------------------------+--------------------------------------------------------+---------+ | pylint | pylint | | +-----------------------------------------------------------+--------------------------------------------------------+---------+ | python-no-log-warn | Check if there are no deprecate log warn | | diff --git a/dev/breeze/doc/images/output_static-checks.svg b/dev/breeze/doc/images/output_static-checks.svg index eed9bf8f570b7..40c8e5cde5db2 100644 --- a/dev/breeze/doc/images/output_static-checks.svg +++ b/dev/breeze/doc/images/output_static-checks.svg @@ -1,4 +1,4 @@ - +