Replace flake8 with ruff.

This commit is contained in:
Itamar Turner-Trauring 2023-04-17 10:21:20 -04:00
parent aafbb00333
commit 7b33931df2
5 changed files with 19 additions and 8 deletions

2
.gitignore vendored
View File

@ -53,3 +53,5 @@ zope.interface-*.egg
# This is the plaintext of the private environment needed for some CircleCI
# operations. It's never supposed to be checked in.
secret-env-plain
.ruff_cache

12
.ruff.toml Normal file
View File

@ -0,0 +1,12 @@
select = [
# Pyflakes checks
"F",
# Prohibit tabs:
"W191",
# No trailing whitespace:
"W291",
"W293",
# Make sure we bind closure variables in a loop (equivalent to pylint
# cell-var-from-loop):
"B023",
]

View File

@ -6,6 +6,9 @@ develop = update_version develop
bdist_egg = update_version bdist_egg
bdist_wheel = update_version bdist_wheel
# This has been replaced by ruff (see .ruff.toml), which has same checks as
# flake8 plus many more, and is also faster. However, we're keeping this config
# in case people still use flake8 in IDEs, etc..
[flake8]
# Enforce all pyflakes constraints, and also prohibit tabs for indentation.
# Reference:

View File

@ -399,12 +399,11 @@ setup(name="tahoe-lafs", # also set in __init__.py
"gpg",
],
"test": [
"flake8",
# Pin a specific pyflakes so we don't have different folks
# disagreeing on what is or is not a lint issue. We can bump
# this version from time to time, but we will do it
# intentionally.
"pyflakes == 3.0.1",
"ruff==0.0.261",
"coverage ~= 5.0",
"mock",
"tox ~= 3.0",

View File

@ -108,14 +108,9 @@ setenv =
# entire codebase, including various pieces of supporting code.
DEFAULT_FILES=src integration static misc setup.py
commands =
flake8 {posargs:{env:DEFAULT_FILES}}
ruff check {posargs:{env:DEFAULT_FILES}}
python misc/coding_tools/check-umids.py {posargs:{env:DEFAULT_FILES}}
python misc/coding_tools/check-debugging.py {posargs:{env:DEFAULT_FILES}}
# B023: Find loop variables that aren't bound in a loop, equivalent of pylint
# cell-var-from-loop.
# W291,W293: Trailing whitespace.
# ruff could probably replace flake8 and perhaps above tools as well...
ruff check --select=B023,W291,W293 {posargs:{env:DEFAULT_FILES}}
# If towncrier.check fails, you forgot to add a towncrier news
# fragment explaining the change in this branch. Create one at