Skip to content

Commit

Permalink
Replace flake8 linter with ruff linter/formatter
Browse files Browse the repository at this point in the history
* By replacing flake8 with ruff we can now automatically fix the linter
  errors with `ruff check --fix`.

* ruff found an instance of a D410 D411 violation that was fixed
  • Loading branch information
agoscinski committed May 20, 2024
1 parent 4662d5b commit 8850641
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 23 deletions.
29 changes: 29 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -86,3 +86,32 @@ indent = 4
include_trailing_comma = true
lines_after_imports = 2
known_first_party = "skmatter"

[tool.ruff]
exclude = ["docs/src/examples/"]
lint.ignore = [
"F401",
"E203",
"D100",
"D101",
"D102",
"D205",
"D400",
"D401",
]
line-length = 88
lint.select = [
"D",
"E",
"F",
"W",
]

[tool.ruff.lint.pydocstyle]
convention = "numpy"

[tool.ruff.lint.per-file-ignores]
"examples/**" = [
"D205",
"D400",
]
1 change: 1 addition & 0 deletions src/skmatter/decomposition/_kernel_pcovr.py
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,7 @@ def score(self, X, Y):
independent (predictor) variable
Y : numpy.ndarray
dependent (response) variable
Returns
-------
L : float
Expand Down
27 changes: 4 additions & 23 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,11 @@ skip_install = true
deps =
black
blackdoc
flake8
flake8-bugbear
flake8-docstrings
flake8-sphinx-links
ruff
isort
sphinx-lint
commands =
flake8 {[tox]lint_folders}
ruff check {[tox]lint_folders}
black --check --diff {[tox]lint_folders}
blackdoc --check --diff {[tox]lint_folders}
isort --check-only --diff {[tox]lint_folders}
Expand All @@ -75,10 +72,12 @@ commands =
# formatting on all files
skip_install = true
deps =
ruff
black
blackdoc
isort
commands =
ruff check --fix {[tox]lint_folders}
black {[tox]lint_folders}
blackdoc {[tox]lint_folders}
isort {[tox]lint_folders}
Expand All @@ -92,21 +91,3 @@ extras = examples
commands =
sphinx-build {posargs:-E} -W -b doctest docs/src docs/build/doctest
sphinx-build {posargs:-E} -W -b html docs/src docs/build/html

[flake8]
max_line_length = 88
exclude =
docs/src/examples/
docstring-convention = numpy
per-file-ignores =
# D205 and D400 are incompatible with the requirements of sphinx-gallery
examples/**:D205, D400
ignore =
E203
D100
D101
D102
D205
D400
D401
W503

0 comments on commit 8850641

Please sign in to comment.