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

simplify loop in collect_exts_file_info #4689

Open
wants to merge 2 commits into
base: 5.0.x
Choose a base branch
from

Conversation

Flamefire
Copy link
Contributor

The loop over exts_list uses an excessive amount of branches and hence indentation making it hard to read.

We have 3 simple cases:

  1. Extension is a string -> use it as the name and do nothing else
  2. extension is neither a string, list nor dict -> Error out
  3. extension is a list of only a name -> use as the name and do nothing else

Moving the type check to the top of the loop makes it instantly visible which types are accepted, the elifs at the bottom are hard to find after all the indents.

Using continue after handling the simple cases reduces the indentation by 2 levels and makes it clear, that nothing else is done for those.

The loop body is so large, that the allowed/checked types are very hard
to find.
When we only have a name, just continue and avoid the extra indent
@boegel boegel added this to the 5.0 milestone Nov 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants