Skip to content
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

Open
wants to merge 17 commits into
base: develop
Choose a base branch
from

Conversation

Gui-FernandesBR
Copy link
Member

@Gui-FernandesBR Gui-FernandesBR commented Jun 14, 2024

We are going to officially adopt pylint in this repo.

Github Actions workflows erre updated:

  • The black/linter bot will no longer commit to this repo
  • When opening a PR, isort, black and pylint will be executed to verify if the code follows

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

@Gui-FernandesBR Gui-FernandesBR marked this pull request as ready for review June 23, 2024 16:05
@Gui-FernandesBR Gui-FernandesBR requested review from a team as code owners June 23, 2024 16:05
@Gui-FernandesBR Gui-FernandesBR self-assigned this Jun 23, 2024
@Gui-FernandesBR Gui-FernandesBR added C.I. Continuous Integration (Workflows and actions) Refactor labels Jun 23, 2024
Copy link
Collaborator

@phmbressan phmbressan left a 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.

.github/workflows/linters.yml Outdated Show resolved Hide resolved
@@ -312,16 +326,16 @@ exclude-too-few-public-methods=
ignored-parents=

# Maximum number of arguments for function / method.
max-args=10
max-args=30
Copy link
Collaborator

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
Copy link
Collaborator

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
Copy link
Collaborator

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.

rocketpy/environment/environment.py Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C.I. Continuous Integration (Workflows and actions) Refactor
Projects
Status: Backlog
Development

Successfully merging this pull request may close these issues.

None yet

2 participants