Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR corresponds to the first step towards using
ruff
for linting and formatting in the pyedb project, as described in #1237.As such, completion of this PR should not result in closing #1237.
The present changes aim at providing pyedb with a similar basic
ruff
configuration as the one implemented for pyaedt in ansys/pyaedt#6157, removingisort
,black
andflake8
at the same time.It should be noted that
ruff
does not replace the following tools, whose use in the project is therefore not affected by the changes introduced here:blacken-docs
(used for formatting Python code blocks in documentation files):ruff
does not support formatting/linting of embedded code (particularly in .rst or .md files). Similarly,blacken-docs
does not support theruff
formatter as an alternative forblack
. This tool is therefore retained (as a pre-commit hook), despite the remaining dependency onblack
,codespell
(fixes common misspellings in source code and other files), which is not integrated intoruff
,numpydoc
(used for formatting docstrings), which is also not integrated intoruff
.The changes in this PR are limited to the definition of a minimal configuration for
ruff
(in thepyproject.toml
file) with only a small set of rules (namely "I"(sort) rules) applied to the code base, together with the introduction of pre-commit hooks for linting and formatting withruff
. Python files fixed byruff
are updated. Configurations forisort
,black
andflake8
are removed and the associated pre-commit hooks are also dropped.The currently ignored rules (exhaustive list provided) shall be gradually applied to the project in subsequent PRs.
It is also worth mentioning that the list of rules selected until now for linting in the
.flake8
file is not regarded as a reference for defining the implementedruff
configuration. Instead, this config is based on the recommendations from the pyansys-dev-guide, as introduced in ansys/pyansys-dev-guide#592.