-
Notifications
You must be signed in to change notification settings - Fork 203
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
fix code style issues in easybuild.tools + add flake8 linting test #3282
Conversation
@Flamefire This should be accompanied by running |
d0e0e31
to
26bad44
Compare
@boegel Done. Again I'm using a separate job (even a separate yaml file) to make it cleaner and run only once. For flake8 it doesn't make sense to run it with multiple pythons. latest is enough. Also see the name. IMO "Static Analysis / python-linting" is way more concise then the rather verbose "EasyBuild framework unit tests / build" which hides the more important parts. I'd suggest renaming those to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PRs like this should definitely not get bigger than this one is...
Although the changes were not done manually, they should still be carefully reviewed, and surprises may pop up...
@boegel Added a couple of comments. For the remaining ones: Can we agree to keep this series of PRs focused on PEP8 compliance so flake8 can be enabled? If one is supposed to improve/fix/change every code piece that is neighbouring to code touched by autopep8 we won't finish anytime soon. So I would really prefer to just fix the PEP8 failures and only change where it is useful for pep8 or an introduced regression. Examples:
I'm a fan of the boy scout rule but not for a (semi-)automatic style fix which is big enough already. Final note on e.g. variable renaming: Linters can be used to detect single-letter variables too. This could be done after flake8 passes :) |
@Flamefire I understand that you want to avoid that the scope of this PR keeps expanding, so feel free to disagree with some suggested changes (and maybe consider opening a separate PR (or issue) for them). Agreed on W.r.t. single-letter variables outside of list comprehensions: OK to consider outside the scope of this PR. Do you know of a linter that has a check for this specifically? |
Ok then I'll define the scope as to not introduce new issues. This should be easily checkable. There is a flake8 plugin which checks general naming: https://pypi.org/project/pep8-naming/ And more generically (superset of that plugin): pylint. http://pylint.pycqa.org/en/latest/user_guide/options.html See e.g. https://stackoverflow.com/questions/21833872/why-does-pylint-object-to-single-character-variable-names |
Closes all open discussions but 1 either by fixing or mentioning cause for not fixing according to above. Need your call on how to handle #3282 (comment) |
First step towards getting flake8 pass for the whole repo to inspect what
autopep8
can do.Command run:
autopep8 -r -i --max-line-length 120 easybuild/tools
andautopep8 -a -r -i --max-line-length 120 easybuild/tools
Note: Don't use aggressive level 2 (
-aa
) as this will changeif x == True
toif x
which is a semantic change: hhatto/autopep8#539