Skip to content
Snippets Groups Projects
Verified Commit 2767d54e authored by Karel van Klink's avatar Karel van Klink :smiley_cat:
Browse files

replace isort, flake8, and black with ruff extensions. Also add a LOT of new linting rules

parent 1295b282
Branches
Tags
1 merge request!111Feature/ruff everything party hat emoji
[tool.isort]
profile = "black"
line_length = 120
skip = ["venv", ".tox", "gso/migrations", "docs"]
known_third_party = ["pydantic", "migrations"]
known_first_party = ["test", "docs"]
[tool.black]
line-length = 120
target-version = ["py311"]
exclude = '''
(
/(
geant_service_orchestrator\.egg-info # exclude a few common directories in the
| \.git # root of the project
| \.*_cache
| \.tox
| venv
| docs
| gso/migrations
)/
)
'''
[tool.mypy] [tool.mypy]
exclude = [ exclude = [
"venv", "venv",
...@@ -60,45 +36,64 @@ exclude = [ ...@@ -60,45 +36,64 @@ exclude = [
"venv", "venv",
"gso/migrations", "gso/migrations",
"docs", "docs",
"_ipam.py" # TODO: remove
] ]
ignore = [ ignore = [
"C417",
"D100",
"D101",
"D102",
"D103",
"D104",
"D105",
"D106",
"D107",
"D202",
"D203", "D203",
"D213", "D213",
"E501",
"N806",
"B905",
"N805", "N805",
"B904",
"N803",
"N801",
"N815",
"N802",
"S101"
] ]
line-length = 120 line-length = 120
select = [ select = [
"A",
"ARG",
"B", "B",
"BLE",
"C", "C",
"COM",
"C4",
"C90",
"D", "D",
"DTZ",
"E", "E",
"EM",
"ERA",
"F", "F",
"FA",
"FBT",
"FIX",
"FLY",
"FURB",
"G",
"I", "I",
"ICN",
"INP",
"ISC",
"LOG",
"N", "N",
"PERF",
"PGH",
"PIE",
"PL",
"PT",
"PTH",
"PYI",
"Q",
"RET",
"R",
"RET", "RET",
"RSE",
"RUF",
"S", "S",
"SIM",
"SLF",
"T", "T",
"T20",
"TD",
"TID",
"TRY",
"UP",
"W", "W",
"YTT"
] ]
target-version = "py311" target-version = "py311"
...@@ -106,7 +101,7 @@ target-version = "py311" ...@@ -106,7 +101,7 @@ target-version = "py311"
ban-relative-imports = "all" ban-relative-imports = "all"
[tool.ruff.per-file-ignores] [tool.ruff.per-file-ignores]
"test/*" = ["B033", "N816", "N802"] "test/*" = ["S101", "PLR2004"]
[tool.ruff.isort] [tool.ruff.isort]
known-third-party = ["pydantic", "migrations"] known-third-party = ["pydantic", "migrations"]
......
[tox] [tox]
envlist = py311 envlist = py311
[flake8]
; Allow >> on newline (W503), and allow cls as first argument for pydantic validators (B902)
ignore = B902,W503
exclude = .git,.*_cache,.eggs,*.egg-info,__pycache__,venv,.tox,gso/migrations,docs
enable-extensions = G
select = B,C,D,E,F,G,I,N,S,T,W,B902,B903,R
max-line-length = 120
ban-relative-imports = true
[pytest] [pytest]
markers = workflow markers = workflow
...@@ -19,21 +10,16 @@ setenv = ...@@ -19,21 +10,16 @@ setenv =
OAUTH2_ACTIVE = False OAUTH2_ACTIVE = False
deps = deps =
coverage coverage
flake8
black
mypy mypy
ruff ruff
isort
types-requests types-requests
celery-stubs celery-stubs
-r requirements.txt -r requirements.txt
commands = commands =
isort -c .
ruff . ruff .
black --check . ruff format --respect-gitignore --preview --check .
mypy . mypy .
flake8
coverage erase coverage erase
coverage run --source gso --omit="gso/migrations/*" -m pytest {posargs} coverage run --source gso --omit="gso/migrations/*" -m pytest {posargs}
coverage xml coverage xml
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment