-
Notifications
You must be signed in to change notification settings - Fork 1.4k
[airflow
] Apply auto fixes to cases where the names have changed in Airflow 3 (AIR301
)
#17355
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Hey @ntBre , I found out a |
That usually points to a loop between two rules, for example one rule might add an import and the other deletes it. Based on the test that's failing, it probably only has one rule (AIR301) enabled, so it would probably have to be a loop within that rule. Do any of the replacements overlap? Something like import a # error, import b instead Fixed to import b # error, import a instead Fixed to import a and so on. There could even be more parts in the chain like |
Hmm... don't think we have such case. but will take a deeper look. |
I'm not sure how the fix has been implemented but a potential reason this might be happening is there are multiple autofixes (more than the iteration limit) which is trying to edit the same line of import. This could happen when there are multiple references of the same deprecated symbol and each reference has generated an edit to update the import. Now, that edit belongs to the same line so Ruff will only apply a single edit and avoid fixing the rest. Those will then be carried over to the next iteration. I guess this is why the autoimporter logic created an error. But, I'll need to look closely as to why this is happening. It might be worth printing out some of the variables in the fix loop to see why the linter is not able to apply the fixes in a single loop. (Posting from phone) |
I've not yet had the bandwidth to come back to this one. 😞 But multiple fix on the same line sounds like a highly likely cause 🤔 |
2f3baf1
to
6d6e414
Compare
airflow
] Apply fixes to cases that names that have been changed in Airflow 3 (AIR301
)
6d6e414
to
51b81b3
Compare
airflow
] Apply fixes to cases that names that have been changed in Airflow 3 (AIR301
)airflow
] Apply fixes to cases that names changed in Airflow 3 (AIR301
)
airflow
] Apply fixes to cases that names changed in Airflow 3 (AIR301
)airflow
] Apply auto fixes to cases where the names have changed in Airflow 3 (AIR301
)
Hey, @ntBre I just wrap up this one. Would be nice if you could take a look when you have time. Thanks 🙂 |
|
code | total | + violation | - violation | + fix | - fix |
---|---|---|---|---|---|
AIR301 | 11 | 0 | 1 | 10 | 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, looks good to me!
I guess one quick question about the ecosystem check: Otherwise the ecosystem check looks good, it shows new fixes for the other matches. |
I think it's fixed here? https://github.com/astral-sh/ruff/pull/17355/files#diff-493d19bbac615454a597e22069204d09be7c4e125ce6494d9cd85289278b141fR231 or are you referring to something else |
I'm talking about this entry from the ecosystem check: https://github.com/apache/airflow/blob/689608d7423cebf7c72d0e0c0081eceeeac51b3a/providers/common/compat/src/airflow/providers/common/compat/openlineage/utils/utils.py#L40 All of the other entries have one new diagnostic (+) and one removed diagnostic (-), but this one shows only a removed diagnostic:
I just wanted to make sure that was an expected result before merging. |
51b81b3
to
1bb93e7
Compare
If I'm not mistaken, it seems we'll be running this branch against the Airflow codebase.I think the behavior is correct in this version as the code is guarded by try-catch. I'm not sure why it was there though 🤔 |
Sounds good, I'll go ahead and merge. Just wanted to make sure that was expected 🙂 |
…tructor * origin/main: [red-knot] Trust module-level undeclared symbols in stubs (#17577) [`airflow`] Apply auto fixes to cases where the names have changed in Airflow 3 (`AIR301`) (#17355) [`pycodestyle`] Auto-fix redundant boolean comparison (`E712`) (#17090) [red-knot] Detect semantic syntax errors (#17463) Fix stale diagnostics in Ruff playground (#17583) [red-knot] Early return from `project.is_file_open` for vendored files (#17580)
…var-instance * dcreager/generic-constructor: Revert FunctionLiteral type [red-knot] Trust module-level undeclared symbols in stubs (#17577) [`airflow`] Apply auto fixes to cases where the names have changed in Airflow 3 (`AIR301`) (#17355) [`pycodestyle`] Auto-fix redundant boolean comparison (`E712`) (#17090) Clean this up a bit clippy [red-knot] Detect semantic syntax errors (#17463) Fix stale diagnostics in Ruff playground (#17583) [red-knot] Early return from `project.is_file_open` for vendored files (#17580)
Summary
Apply auto fixes to cases where the names have changed in Airflow 3
Test Plan
Add
AIR301_names_fix.py
andAIR301_provider_names_fix.py
test fixtures