-
-
Notifications
You must be signed in to change notification settings - Fork 136
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
MNT: Refactors the code to adopt pylint #621
base: develop
Are you sure you want to change the base?
Conversation
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.
Good work. I left some suggestions, I am not an expert on linters, so take those with a grain of salt: but I do think some of the defined linting rules are not strict enough.
This already has produced improvements and more idiomatic code and has potential to accelerate our reviews.
For the long term, let's keep in mind always that linters are good to suggest improvements, but they do not force you to anything, there are edge cases.
@@ -312,16 +326,16 @@ exclude-too-few-public-methods= | |||
ignored-parents= | |||
|
|||
# Maximum number of arguments for function / method. | |||
max-args=10 | |||
max-args=30 |
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.
30
? That seems a bit too high, my suggestion would be 15 which is already quite a lot.
|
||
# Maximum number of boolean expressions in an if statement (see R0916). | ||
max-bool-expr=5 | ||
|
||
# Maximum number of branch for function / method body. | ||
max-branches=12 | ||
max-branches=50 |
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.
I guess we might have some methods that surpass the default here, but I don't think raising the limit too much makes sense.
Surpassing the default should be an advise to refactor. I know this is not the purpose of this PR, but disabling the issue in the problematic methods would likely do more to remind us on refactors than putting the value too high (in my opinion).
|
||
# Maximum number of return / yield for function / method body. | ||
max-returns=6 | ||
max-returns=50 |
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.
The same comment I made earlier on setting the limits too high.
I don't know which method right now approaches 50 returns, but that is too much. I do think that the default is too low, though.
Also, it makes sense if this value stays close to the max_branch
(which it is right now). My suggestion would be like 21.
We are going to officially adopt pylint in this repo.
Github Actions workflows erre updated:
I fixed
many
pylint errors, but it was a really hard task, quite time consuming. Therefore, I had to use pylint-silent to ignore some errors, those will be solved in the future, one by one.You don't have to read all the files. Focus on the new github workflow files and the .pylintrc file