-
Notifications
You must be signed in to change notification settings - Fork 8
chore: use ruff with ruff.toml file #594
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
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.
Thanks for this PR @ecoussoux-ansys, I left some minor comments
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.
Here is a new batch of suggestion :)
Nice work. I am glad that our dev guide was updated according to our current guidance promoting ruff usage. |
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.
LGTM
* feat: Introducing Ruff config, removing .flake8, updating pre-commit-config * feat: Adding ruff-format hook to pre-commit, updating fixed files * feat: Adding linting rules to Ruff config, updating fixed file * feat: Extending Ruff linting rules list, updating fixed files * feat: Reverting change breaking doc build, updating ignored linting rules * Apply suggestions from code review Co-authored-by: Sébastien Morais <[email protected]> * feat: Updating pyansys_logging and ruff config based on review comments * Update doc/source/how-to/code/test_pyansys_logging.py Co-authored-by: Sébastien Morais <[email protected]> * feat: Removing ignored rules from ruff config and updating files accordingly * Update doc/source/how-to/code/test_pyansys_logging.py --------- Co-authored-by: Sébastien Morais <[email protected]>
This PR implements the change discussed in #593, i.e. migrating the pyansys-dev-guide to Ruff.
The specific configs for Black, isort and flake8 are removed and the .pre-commit-config.yaml file is updated accordingly, while a ruff.toml file defining the rules used by Ruff for linting and formatting is introduced.
Python files fixed by Ruff are updated.
Since the project does not currently contain a pyproject.toml file, it was decided not to define one for the purpose of holding the Ruff configuration, but instead to specify it in a ruff.toml file placed at the root of the project. The introduction of a pyproject.toml file is considered to be beyond the scope of this PR, which is the motivation for this choice.
Should a pyproject.toml file be created in the future, the content of the ruff.toml can simply be added to it and this config file removed.
As indicated in #593, the use of blacken-docs in .pre-commit-config.yaml is maintained as this tool (used for formatting Python code blocks in documentation files) cannot currently be replaced by Ruff, which does not support formatting/linting of embedded code (particularly in .rst or .md files, see astral-sh/ruff#8237). Similarly, blacken-docs does not support the Ruff formatter as an alternative for Black (see adamchainz/blacken-docs#352).
This tool is therefore retained (see here about the Ruff pre-commit hook astral-sh/ruff-pre-commit#55) for this project, despite the remaining dependence on Black.
Close #593