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.
Summary:
pyproject.toml
: add configuration forruff
linter 1 2.pre-commit-config.yaml
: addpre-commit
hook forruff
(while removingflake8
's one) 3.github/workflows/actions.yaml
: setup action forruff
linter (while removingflake8
's one)ruff
andblack
proposed fixespoetry.lock
,pyproject.toml
,setup.cfg
: removeflake8
dependencypyproject.toml
:fixable = ["ALL"]
is redundant 4README.md
: updateREADME
as a consequence of enforcing the use ofruff
overflake8
Footnotes
better nest linter-specific configs under
[tool.ruff.lint]
, formatter-specific configs under[tool.ruff.format]
and configs common to both linter and formatter under[tool.ruff]
(see https://github.com/astral-sh/ruff/discussions/9406) ↩note that
ruff
's autofix feature is available for most of the lint rules, but not for all of them (eg an autofix forA001
is not available, as I could experience); list of available autofixes at https://docs.astral.sh/ruff/linter/#fix-safetyruff
's autofix feature does not apply to unsafe fixes (egC414
, as I could experience); you'd need to promote unsafe fixes to safe by specifying egextend-safe-fixes = ["C414"]
under[tool.ruff.lint]
(see https://docs.astral.sh/ruff/linter/#fix-safety) or proceed manuallybe aware of putting
ruff
's linter hook before any formatter hook (black
here) asruff
's--fix
might apply changes requiring reformatting, which indeed happened (see https://docs.astral.sh/ruff/integrations/#pre-commit) ↩fixable = ["ALL"]
is the default already. Better configure such option in order to specify the (sub)-list of selected (i.e. specified inselect =
) rules that you would not only check against but also autofix (provided that an autofix is available for them and is safe); indeed, there might be rules you would check against, but manually (and not automatically) fix ↩