-
Notifications
You must be signed in to change notification settings - Fork 56
Description
🐞 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:
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:
- pydocstyle: checks docstrings.
- codespell: checks for misspelled words in text.
💡 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.ymlfile. - 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.