Skip to content

Support inline ignore marker for check-sdk-imports hook#66519

Merged
jason810496 merged 2 commits intoapache:mainfrom
jason810496:ci/support-ignore-for-check-sdk-imports-hook
May 7, 2026
Merged

Support inline ignore marker for check-sdk-imports hook#66519
jason810496 merged 2 commits intoapache:mainfrom
jason810496:ci/support-ignore-for-check-sdk-imports-hook

Conversation

@jason810496
Copy link
Copy Markdown
Member

Why

There are cases where importing airflow.sdk modules in airflow-core is intentionally needed, but the check-sdk-imports prek hook has no way to suppress individual violations. Mirrors the # nocheck: core-imports support added for check_core_imports_in_sdk in #65358.

What

  • Add # nocheck: sdk-imports inline comment marker support to check_sdk_imports.py, allowing specific import lines to be excluded from the check.
  • The marker works on both single-line and multi-line from airflow.sdk import (...) statements (on the first line, any middle line, or the closing paren line).
  • Add tests for the check_sdk_imports hook covering both the existing detection behavior and the new nocheck marker.

Was generative AI tooling used to co-author this PR?

@jason810496 jason810496 self-assigned this May 7, 2026
@boring-cyborg boring-cyborg Bot added area:dev-tools backport-to-v3-2-test Mark PR with this label to backport to v3-2-test branch labels May 7, 2026
Copy link
Copy Markdown
Contributor

@amoghrajesh amoghrajesh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some nits, otherwise LGTM

Comment thread scripts/ci/prek/check_sdk_imports.py Outdated
Comment thread scripts/ci/prek/check_sdk_imports.py Outdated
Comment thread scripts/ci/prek/check_sdk_imports.py Outdated
@jason810496 jason810496 merged commit 7bae68f into apache:main May 7, 2026
143 checks passed
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 7, 2026

Backport successfully created: v3-2-test

Note: As of Merging PRs targeted for Airflow 3.X
the committer who merges the PR is responsible for backporting the PRs that are bug fixes (generally speaking) to the maintenance branches.

In matter of doubt please ask in #release-management Slack channel.

Status Branch Result
v3-2-test PR Link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:dev-tools backport-to-v3-2-test Mark PR with this label to backport to v3-2-test branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants