Skip to content

Commit 5020e47

Browse files
committed
add ruff configuration
same as xcp repository. Some checks are excluded in the tests directory, because pytest imposes to use some imports as functions arguments, and the linter doesn't know about that. Signed-off-by: Gaëtan Lehmann <[email protected]>
1 parent d2fdebe commit 5020e47

File tree

3 files changed

+61
-0
lines changed

3 files changed

+61
-0
lines changed

pyproject.toml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,42 @@ dev = [
2424
"pydocstyle",
2525
"pyright",
2626
"pyyaml>=6.0",
27+
"ruff",
2728
"types-requests",
2829
"typing-extensions",
2930
]
3031

3132
[tool.pyright]
3233
typeCheckingMode = "standard"
34+
35+
[tool.ruff]
36+
preview = true
37+
line-length = 120
38+
exclude = ["data.py", "vm_data.py", ".git"]
39+
40+
[tool.ruff.format]
41+
quote-style = "preserve"
42+
43+
[tool.ruff.lint]
44+
select = [
45+
"F", # Pyflakes
46+
"I", # isort
47+
"SLF", # flake8-self
48+
"SIM", # flake8-simplify
49+
]
50+
# don't use some of the SIM rules
51+
ignore = [
52+
"SIM105", # suppressible-exception
53+
"SIM108", # if-else-block-instead-of-if-exp
54+
]
55+
56+
[tool.ruff.lint.extend-per-file-ignores]
57+
# pytest requires some import and function arguments to match, but
58+
# the linter doesn't know that
59+
"tests/**/*.py" = [
60+
"F401", # F401 unused-import
61+
"F811", # F811 redefined-while-unused
62+
]
63+
64+
[tool.ruff.lint.isort]
65+
lines-after-imports = 1

requirements/dev.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ flake8
66
pydocstyle
77
pyright
88
pyyaml>=6.0
9+
ruff
910
types-requests
1011
typing-extensions
1112
-r base.txt

uv.lock

Lines changed: 27 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)