Skip to content
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

python: Early exit from functions or loops #4910

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

echoix
Copy link
Member

@echoix echoix commented Jan 3, 2025

This PR extracts the refactorings made by the Pyrefact tool concerning early exiting loops or functions, and changes related to changing the order of the conditions. Ruff has some rules, that are ignored, that can detect some of these. Some similar changes were already done a couple of months ago, but the pyrefact tool seems more powerful for these as it manipulates the AST (thus why some comments are lost and I manually replace them). I expect the ruff issue count (including ignored) to be smaller after these changes.

echoix added 2 commits January 3, 2025 00:57
Flattens nested conditionals and moves error messages near the top
Flattens nested conditionals and moves error messages or returns near the top
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
libraries notebook Python Related code is in Python
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant