ci: switch to ruff for linting

Signed-off-by: Akhil Narang <me@akhilnarang.dev>
This commit is contained in:
Akhil Narang 2024-02-05 18:32:12 +05:30
parent 25a3baa632
commit fbb0e44791
No known key found for this signature in database
GPG key ID: 9DCC61E211BF645F
3 changed files with 37 additions and 96 deletions

75
.flake8
View file

@ -1,75 +0,0 @@
[flake8]
ignore =
B001,
B007,
B009,
B010,
B950,
E101,
E111,
E114,
E116,
E117,
E121,
E122,
E123,
E124,
E125,
E126,
E127,
E128,
E131,
E201,
E202,
E203,
E211,
E221,
E222,
E223,
E224,
E225,
E226,
E228,
E231,
E241,
E242,
E251,
E261,
E262,
E265,
E266,
E271,
E272,
E273,
E274,
E301,
E302,
E303,
E305,
E306,
E402,
E501,
E502,
E701,
E702,
E703,
E741,
F401,
F403,
F405,
W191,
W291,
W292,
W293,
W391,
W503,
W504,
E711,
E129,
F841,
E713,
E712,
B028,
max-line-length = 200
exclude=,test_*.py

View file

@ -20,18 +20,12 @@ repos:
- id: check-yaml
- id: debug-statements
- repo: https://github.com/asottile/pyupgrade
rev: v3.9.0
hooks:
- id: pyupgrade
args: ['--py310-plus']
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.2.0
hooks:
- id: ruff
name: "Sort Python imports"
args: ["--select", "I", "--fix"]
name: "Run ruff linter and apply fixes"
args: ["--fix"]
- id: ruff-format
name: "Format Python code"
@ -72,12 +66,6 @@ repos:
frappe/public/js/lib/.*
)$
- repo: https://github.com/PyCQA/flake8
rev: 6.0.0
hooks:
- id: flake8
additional_dependencies: ['flake8-bugbear',]
ci:
autoupdate_schedule: weekly
skip: []

View file

@ -88,13 +88,6 @@ dependencies = [
requires = ["flit_core >=3.4,<4"]
build-backend = "flit_core.buildapi"
[tool.ruff]
line-length = 110
[tool.ruff.format]
indent-style = "tab"
docstring-code-format = true
[tool.bench.dev-dependencies]
coverage = "~=6.5.0"
Faker = "~=18.10.1"
@ -104,3 +97,38 @@ watchdog = "~=3.0.0"
hypothesis = "~=6.77.0"
responses = "==0.23.1"
freezegun = "~=1.2.2"
[tool.ruff]
line-length = 110
target-version = "py310"
[tool.ruff.lint]
select = [
"F",
"E",
"W",
"I",
"UP",
"B",
]
ignore = [
"B017", # assertRaises(Exception) - should be more specific
"B018", # useless expression, not assigned to anything
"B023", # function doesn't bind loop variable - will have last iteration's value
"B904", # raise inside except without from
"E101", # indentation contains mixed spaces and tabs
"E402", # module level import not at top of file
"E501", # line too long
"E741", # ambiguous variable name
"F401", # "unused" imports
"F403", # can't detect undefined names from * import
"F405", # can't detect undefined names from * import
"F722", # syntax error in forward type annotation
"F821", # undefined name
"W191", # indentation contains tabs
]
[tool.ruff.format]
quote-style = "double"
indent-style = "tab"
docstring-code-format = true