Skip to content

Commit 6d64d61

Browse files
DimitriPapadopoulosadrienverge
authored andcommitted
style: Enforce ruff rules
1 parent 3fda7f9 commit 6d64d61

2 files changed

Lines changed: 49 additions & 1 deletion

File tree

.github/workflows/tests.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,11 @@ jobs:
2323
with:
2424
python-version: "3.x"
2525
- run:
26-
pip install flake8 flake8-import-order sphinx sphinx_rtd_theme
26+
pip install flake8 flake8-import-order ruff sphinx sphinx_rtd_theme
2727
rstcheck[sphinx] doc8
2828
- run: pip install .
2929
- run: flake8 .
30+
- run: ruff check --output-format=github
3031
- run: doc8 $(git ls-files '*.rst')
3132
- run: rstcheck --ignore-directives automodule $(git ls-files '*.rst')
3233
- run: yamllint --strict $(git ls-files '*.yaml' '*.yml')

pyproject.toml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ dev = [
2828
"flake8",
2929
"flake8-import-order",
3030
"rstcheck[sphinx]",
31+
"ruff",
3132
"sphinx",
3233
]
3334

@@ -51,3 +52,49 @@ yamllint = ["conf/*.yaml"]
5152

5253
[tool.setuptools.dynamic]
5354
version = {attr = "yamllint.__version__"}
55+
56+
[tool.ruff]
57+
line-length = 79
58+
59+
[tool.ruff.lint]
60+
extend-select = [
61+
"B",
62+
"C4",
63+
"EXE",
64+
"FA",
65+
"ISC",
66+
"LOG",
67+
"G",
68+
"PIE",
69+
"PYI",
70+
"SIM",
71+
"FLY",
72+
"I",
73+
"PERF",
74+
"W",
75+
"PGH",
76+
"PLC",
77+
"PLE",
78+
"UP",
79+
"FURB",
80+
"RUF",
81+
]
82+
ignore = [
83+
"B028", # No explicit `stacklevel` keyword argument found
84+
"SIM102", # Use a single `if` statement instead of nested `if` statements
85+
"SIM103", # Return the negated condition directly
86+
"SIM105", # Use `contextlib.suppress(KeyError)` instead of `try`-`except`-`pass`
87+
"SIM108", # Use ternary operator instead of `if`-`else`-block
88+
"SIM114", # Combine `if` branches using logical `or` operator
89+
"SIM117", # Use a single `with` statement with multiple contexts
90+
"FURB105", # Unnecessary empty string passed to `print`
91+
"RUF001", # String contains ambiguous Unicode characters
92+
"RUF002", # Docstring contains ambiguous Unicode characters
93+
"RUF003", # Comment contains ambiguous Unicode characters
94+
"RUF005", # Consider unpacking instead of concatenation
95+
"RUF100", # Unused `noqa` directive
96+
]
97+
98+
[tool.ruff.lint.isort]
99+
force-sort-within-sections = true
100+
known-third-party = ["tests"]

0 commit comments

Comments
 (0)