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
TVB-2719 lint: Use same convention everywhere #63
Conversation
I used black to format the code. |
Codecov Report
@@ Coverage Diff @@
## trunk #63 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 1 1
Lines 72 72
=========================================
Hits 72 72
Continue to review full report at Codecov.
|
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.
These changes look good for the Python part. How about the Cython part of this library? Is there a cython lint tool which we could apply?
Modified flake8 configuration to enable linting for cython files. |
setup.cfg
Outdated
[flake8] | ||
filename = *.py, *.pyx | ||
ignore = E501, W503 | ||
per_file_ignores = gdist.pyx: E999, E402, E266, E255, E227, E226, E225 |
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.
Would it be possible to copy with every ignored error code also the explanation for it (what we are ignoring).
e.g. E501 # Line too long (82 > 79 characters)
?
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.
Is E402 | Module level import not at top of file
?
Usually I don't like the stile of an import in another place that the top, unless there is a good reason. Do we really need this exception here?
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.
Also are these the ignores we really want:
E225 | Missing whitespace around operator E226 | Missing whitespace around arithmetic operator E227 | Missing whitespace around bitwise or shift operator
They would seem fitting to be obeyed, to me.
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.
Also are these the ignores we really want:
E225 | Missing whitespace around operator E226 | Missing whitespace around arithmetic operator E227 | Missing whitespace around bitwise or shift operator
They would seem fitting to be obeyed, to me.
For pyx
files, flake8 will complain for the pointers (treated as multiplication operator in python) and address-of operator (bitwise and operator in python).
Is
E402 | Module level import not at top of file
?
Usually I don't like the stile of an import in another place that the top, unless there is a good reason. Do we really need this exception here?
Flake8 treats the cimport
s as non-import code and thus complains about the subsequent imports as imports not being on the top.
Would it be possible to copy with every ignored error code also the explanation for it (what we are ignoring).
e.g.E501 # Line too long (82 > 79 characters)
?
Done.
Closes #60