Enable flake8-comprehension code style check and fix issues#3989
Enable flake8-comprehension code style check and fix issues#3989boegel merged 7 commits intoeasybuilders:developfrom
Conversation
E.g.: > C419 Unnecessary list comprehension in <any/all>() prevents short-circuiting - rewrite as a generator. See https://pypi.org/project/flake8-comprehensions
|
@boegel Looks good with recent develop |
|
Test report by @boegel Overview of tested easyconfigs (in order)
Build succeeded for 4 out of 6 (total: 1 hour 30 mins 2 secs) (6 easyconfigs in total) |
|
Test report by @boegel Overview of tested easyconfigs (in order)
Build succeeded for 2 out of 2 (total: 2 hours 43 mins 27 secs) (2 easyconfigs in total) |
https://pypi.org/project/flake8-comprehensions/ has various useful checks, most importantly:
I.e. things like any([expensive_check(x) for x in collection]) runs the check after processing the full collection instead of stopping after the first "match" which costs performance.
To me the whole collection of checks look useful for performance and readability so enable them all.
See easybuilders/easybuild-framework#5043
Requires:
runtime_onlyoptions toEasyConfig.dependency_namesmethod easybuild-framework#5044 fordependency_name(runtime_only=True)I used as some issues involved emulating this function