[airflow] Extract common utilities for use in new rules#23630
Merged
amyreese merged 1 commit intoastral-sh:mainfrom Mar 3, 2026
Merged
[airflow] Extract common utilities for use in new rules#23630amyreese merged 1 commit intoastral-sh:mainfrom
airflow] Extract common utilities for use in new rules#23630amyreese merged 1 commit intoastral-sh:mainfrom
Conversation
a786ed8 to
29ab30f
Compare
|
Contributor
|
Is this an expansion of what |
Contributor
Author
Yes, the rule is changed by this, but this is more of a byproduct of the refactor. In theory, AIR301 becomes more comprehensive in catching deprecated patterns across different Airflow versions. In practice however, I would expect to see new hits in the ecosystem scan of the airflow codebase - which is not the case. |
amyreese
suggested changes
Mar 2, 2026
Move these decorator-checking functions from removal_in_3.rs (AIR301) to helpers.rs so they can be reused by other airflow rules. The shared versions now also match the airflow.sdk.task import path and handle @task.<variant> forms (e.g., @task.branch, @task.short_circuit), ensuring AIR301 context checks work for both Airflow 2 and 3 decorator imports. Co-Authored-By: Claude Opus 4.6 <[email protected]>
29ab30f to
4bdbfcb
Compare
amyreese
approved these changes
Mar 3, 2026
carljm
added a commit
that referenced
this pull request
Mar 16, 2026
* main: [ty] Split up `types/class.rs` (#23714) [ty] Rework module resolution to be breadth-first instead of depth-first (#22449) [ty] Move tests and type-alias-related code out of `types.rs` (#23711) [ty] Move TypeVar-related code to a `types::typevar` submodule (#23710) Fail CI on new linter ecosystem panics (#23597) [ty] Fix handling of non-Python text documents [ty] Move `CallableType`, and related methods/types, to a new `types::callable` submodule (#23707) [ty] Avoid stack overflow with recursive typevar (#23652) [ty] Add a diagnostic for an unused awaitable (#23650) [ty] Fix union `*args` binding for optional positional parameters (#23124) [`refurb`] Fix `FURB101` and `FURB103` false positives when I/O variable is used later (#23542) [ty] Fix type checking for multi-member enums within in a function block (#23683) [ty] Improve folding for decorators (#23543) [`airflow`] Extract common utilities for use in new rules (#23630)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Extract
is_airflow_taskandin_airflow_task_functionfromremoval_in_3.rs(AIR301) into the sharedhelpers.rsmodule so they can be reused by other airflow rules.The shared versions include two enhancements over the original private implementations:
airflow.decorators.taskandairflow.sdk.taskimport paths, supporting Airflow 2 and 3 decorator imports.@task.<variant>decorator forms (e.g.,@task.branch,@task.short_circuit), not just@taskand@task().Test Plan
Added
airflow.sdktest cases toAIR301_context.pyconfirming that deprecated context key detection works under both@task(fromairflow.decorators) and@sdk_task(fromairflow.sdk). Existing AIR301 tests continue to pass.RUFF_UPDATE_SCHEMA=1 cargo nextest run -p ruff_linter -- "airflow::tests" cargo clippy -p ruff_linter --all-targets --all-features -- -D warningsRelated: #23579 #23584