-
-
Notifications
You must be signed in to change notification settings - Fork 16
Description
What is the problem or limitation you are having?
This repository currently uses Flake8/isort/Black for code linting and formatting.
Describe the solution you'd like
Ruff should replace Flake8/isort/Black as the code linter and formatter.
This should be done as follows:
- Add Ruff configuration to
pyproject.tomlas included here - Add Ruff checks to
.pre-commit-config.yamlas included here - Remove the
[tool.isort]configuration section frompyproject.toml. - Remove
[flake8]configuration section fromtox.ini. - Run
pre-commit run -ain the repo directory, and let Ruff do any formatting or linting that it can do automatically. - You will almost certainly end up with a list of errors, each identified by an error number.
- In this PR, you will not be making any significant code changes.
- Add a global
ignorelist topyproject.tomlin the[tool.ruff.lint]section, below theextend-selectconfiguration section, including only the rules that apply to this repository. You can find an example of anignorelist here. Include a comment next to the rule indicating what it relates to, as shown. - Run
pre-commit run -ato ensure that all the rules are being successfully ignored. - Add
.ruff_cacheto the.gitignorefile. - There may be some minor code changes necessary because Flake8 and Black don't always agree; these changes should be kept to a minimum.
- Submit the pull request.
Describe alternatives you've considered
None.
Additional context
Once the initial PR is merged, the next step in this process is to begin working through resolving the errors indicated by the rules.
Each rule begins with a letter or set of letters. Each set of rules that begins with the same letter or letters is related. For example, errors B007, B018, and B904 are part of the same ruleset.
Each set of related rules should be worked through together, and submitted as a separate PR for each set of related rules, i.e. submit a PR for the BXXX rules, and a separate PR for the EXXX rules.
The SIMXXX checks are explicitly disabled in the configuration. Do not remove the commented out SIM check, and avoid resolving the SIMXXX errors.