Skip to content

Conversation

@johnslavik
Copy link
Contributor

@johnslavik johnslavik commented Dec 3, 2025

https://docs.astral.sh/ruff/rules/jump-statement-in-finally/

This is a follow up to #58488 (comment), where enabling SIM017 was initially proposed.

This PR, however, enables B012, which is a more general rule that, in addition to return, also catches break and continue in finally blocks -- an exhaustive list of what PEP 765 prohibits.

CC @jscheffl


^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in a newsfragment file, named {pr_number}.significant.rst or {issue_number}.significant.rst, in airflow-core/newsfragments.

@johnslavik
Copy link
Contributor Author

3 fixes needed -- not bad!

@johnslavik
Copy link
Contributor Author

johnslavik commented Dec 3, 2025

@jscheffl How would you like this resolved?

I'd fix B012 errors in separate PRs, then merge this one in. Just so that all the changes in different areas are reviewed by proper owners. To track, I'll file 3 to-do issues from this tomorrow.

@jscheffl
Copy link
Contributor

jscheffl commented Dec 4, 2025

Cool! Thanks for the initiative in enabling!

So in total I see (only) 3 errors, would have expected more. 1 of them is fixed with the PR from @AutomationDev85, the second is in a similar area. And the one in Fab should also be easily fixable in my view.

As there is no harm in B012 and actually I agree it is a bad practice I have nothing against it and would rather favor it to enable it as well. But it is valid, there might be other opinions. Therefore we have pull requests! If we wait that the other PR is opened and the other two are fixed (either in this PR or in separate in parallel, then rebase this one...) then we just leave it open for a few days for others to object.
It is not in a complexity that it would require a VOTE on devlist in my view.

@jscheffl
Copy link
Contributor

jscheffl commented Dec 4, 2025

(I'd say similar like I am incrementally enabling all PLW rules in #58116 with parallel PRs...)

@johnslavik johnslavik closed this by deleting the head repository Dec 4, 2025
@johnslavik
Copy link
Contributor Author

I've had to delete the head repo -- will reopen this once the lints are fixed. Sorry for the hassle, had to move around stuff.

@potiuk
Copy link
Member

potiuk commented Dec 7, 2025

Cool find and waiting for reopening. That's an important rule to have.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants