Skip to content

Commit d91573d

Browse files
committed
Replace flake8 linter with ruff linter/formatter
By replacing flake8 with ruff we can now automatically fix a lot of the linter errors with `ruff check --fix`. Added ignores for D410 D411, to get no additional linter errors.
1 parent df1f3b1 commit d91573d

File tree

2 files changed

+35
-23
lines changed

2 files changed

+35
-23
lines changed

pyproject.toml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,3 +86,34 @@ indent = 4
8686
include_trailing_comma = true
8787
lines_after_imports = 2
8888
known_first_party = "skmatter"
89+
90+
[tool.ruff]
91+
exclude = ["docs/src/examples/"]
92+
lint.ignore = [
93+
"F401",
94+
"E203",
95+
"D100",
96+
"D101",
97+
"D102",
98+
"D205",
99+
"D400",
100+
"D401",
101+
"D410",
102+
"D411",
103+
]
104+
line-length = 88
105+
lint.select = [
106+
"D",
107+
"E",
108+
"F",
109+
"W",
110+
]
111+
112+
[tool.ruff.lint.pydocstyle]
113+
convention = "numpy"
114+
115+
[tool.ruff.lint.per-file-ignores]
116+
"examples/**" = [
117+
"D205",
118+
"D400",
119+
]

tox.ini

Lines changed: 4 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,11 @@ skip_install = true
5555
deps =
5656
black
5757
blackdoc
58-
flake8
59-
flake8-bugbear
60-
flake8-docstrings
61-
flake8-sphinx-links
58+
ruff
6259
isort
6360
sphinx-lint
6461
commands =
65-
flake8 {[tox]lint_folders}
62+
ruff check {[tox]lint_folders}
6663
black --check --diff {[tox]lint_folders}
6764
blackdoc --check --diff {[tox]lint_folders}
6865
isort --check-only --diff {[tox]lint_folders}
@@ -75,10 +72,12 @@ commands =
7572
# formatting on all files
7673
skip_install = true
7774
deps =
75+
ruff
7876
black
7977
blackdoc
8078
isort
8179
commands =
80+
ruff check --fix {[tox]lint_folders}
8281
black {[tox]lint_folders}
8382
blackdoc {[tox]lint_folders}
8483
isort {[tox]lint_folders}
@@ -92,21 +91,3 @@ extras = examples
9291
commands =
9392
sphinx-build {posargs:-E} -W -b doctest docs/src docs/build/doctest
9493
sphinx-build {posargs:-E} -W -b html docs/src docs/build/html
95-
96-
[flake8]
97-
max_line_length = 88
98-
exclude =
99-
docs/src/examples/
100-
docstring-convention = numpy
101-
per-file-ignores =
102-
# D205 and D400 are incompatible with the requirements of sphinx-gallery
103-
examples/**:D205, D400
104-
ignore =
105-
E203
106-
D100
107-
D101
108-
D102
109-
D205
110-
D400
111-
D401
112-
W503

0 commit comments

Comments
 (0)