Skip to content

Commit

Permalink
Also check NEW_SESSION imports in pre-commit (apache#44388)
Browse files Browse the repository at this point in the history
  • Loading branch information
uranusjr authored Nov 27, 2024
1 parent a1fbdb3 commit 890b3ec
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
7 changes: 3 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -750,10 +750,9 @@ repos:
pass_filenames: true
- id: check-provide-create-sessions-imports
language: pygrep
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.
entry: "from airflow\\.utils\\.db import.* (provide_session|create_session)"
name: Check session util imports
description: NEW_SESSION, provide_session, and create_session should be imported from airflow.utils.session to avoid import cycles.
entry: "from airflow\\.utils\\.db import.* (NEW_SESSION|provide_session|create_session)"
files: \.py$
exclude: ^.*/.*_vendor/
pass_filenames: true
Expand Down
2 changes: 1 addition & 1 deletion contributing-docs/08_static_code_checks.rst
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ require Breeze Docker image to be built locally.
+-----------------------------------------------------------+--------------------------------------------------------+---------+
| check-pre-commit-information-consistent | Validate hook IDs & names and sync with docs | |
+-----------------------------------------------------------+--------------------------------------------------------+---------+
| check-provide-create-sessions-imports | Check provide_session and create_session imports | |
| check-provide-create-sessions-imports | Check session util imports | |
+-----------------------------------------------------------+--------------------------------------------------------+---------+
| check-provider-docs-valid | Validate provider doc files | |
+-----------------------------------------------------------+--------------------------------------------------------+---------+
Expand Down

0 comments on commit 890b3ec

Please sign in to comment.