Skip to content

simplify loop in collect_exts_file_info #4689

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

Open
wants to merge 5 commits into
base: develop
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.

@Flamefire Flamefire force-pushed the exts-file-info-simplify branch from b3a7782 to 640b3ea Compare October 23, 2024 14:21
@boegel boegel added this to the 5.0 milestone Nov 6, 2024
@boegel boegel modified the milestones: 5.0.0, 5.x Mar 17, 2025
@boegel boegel changed the base branch from 5.0.x to develop March 19, 2025 10:51
@boegel boegel modified the milestones: 4.x, 5.x Mar 19, 2025
@boegel
Copy link
Member

boegel commented Mar 19, 2025

@Flamefire I changed to target branch in this PR from 5.0.x to develop, you should synchronize your PR branch with current develop branch (which has received a massive update after the release of EasyBuild v5.0.0, see #4825)

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
@Flamefire Flamefire force-pushed the exts-file-info-simplify branch from 640b3ea to 057f268 Compare March 19, 2025 11:56
@boegel boegel modified the milestones: 5.x.x, 5.x Apr 9, 2025
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