From e995c0065b23a000a7572bea0780e636d58bd79b Mon Sep 17 00:00:00 2001 From: pratiksha rajendrabhai badheka Date: Thu, 16 Jan 2025 22:27:15 +0530 Subject: [PATCH 1/5] resolved conflicts --- .pre-commit-config.yaml | 7 +++ contributing-docs/08_static_code_checks.rst | 2 + .../doc/images/output_static-checks.svg | 9 ++- .../doc/images/output_static-checks.txt | 2 +- .../src/airflow_breeze/pre_commit_ids.py | 1 + .../ci/pre_commit/usage_session_attribute.py | 55 +++++++++++++++++++ 6 files changed, 72 insertions(+), 4 deletions(-) create mode 100644 scripts/ci/pre_commit/usage_session_attribute.py diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 8e3b2877895f9..8d2e31e39ffb6 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -223,6 +223,13 @@ 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_attribute + language: python + additional_dependencies: ['rich>=12.4.4'] + files: ^airflow.*\.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..853a2557d6780 100644 --- a/dev/breeze/doc/images/output_static-checks.svg +++ b/dev/breeze/doc/images/output_static-checks.svg @@ -1,4 +1,4 @@ - +