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

Enhance code style checking #261

Closed
jorgepiloto opened this issue Apr 5, 2022 · 3 comments · Fixed by #264
Closed

Enhance code style checking #261

jorgepiloto opened this issue Apr 5, 2022 · 3 comments · Fixed by #264
Assignees
Labels
enhancement Improve any current implemented feature

Comments

@jorgepiloto
Copy link
Member

🐞 Problem

At the moment, only flake8 are being used for checking the code style. Although very useful, this tool does not cover things such us proper import order or code formatting.

Therefore, it is usual to use flake8 together with black and isort:

  • black is the uncompromising Python code formatter.
  • isort makes your imports compliant with PEP-8.

Both tools are very popular in the Python ecosystem. Other projects in the PyAnsys ecosystem such us PyMAPDL also benefit from previous code style tools.

Code quality can also be improved by checking docstrings or misspelled words. For this task, other tools can be used:

💡 Solution

From my point of view, the best way to implement the code style checking is using pre-commit. This has the following advantages:

  • If you install it locally, it will force you to commit code which follows the code style of the project.
  • It can executed in the CI pipelines, simplifying those as all the logic is stored in a .pre-commit-config.yml file.
  • It is already being used in PyMAPDL. This guarantees uniform code style across projects in the PyAnsys ecosystem.

You can always add more style checking utilities on top of previous ones if those are needed at some point.

@jorgepiloto
Copy link
Member Author

Pinging here @mkundu1, @dnwillia-work and @seanpearsonuk to have some feedback on this proposal. If it gets accepted, I will address it.

@seanpearsonuk
Copy link
Collaborator

Hi @jorgepiloto
Thanks very much, please go ahead with this.

@dnwillia-work
Copy link
Collaborator

Yeah, it's good with me. I was planning to look at it soon anyways. Just had not gotten to it.

@dnwillia-work dnwillia-work added the enhancement Improve any current implemented feature label Apr 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improve any current implemented feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants