Skip to content

Commit 8d873c1

Browse files
committed
Switch from black and flake8 to ruff
1 parent 475e4a1 commit 8d873c1

File tree

5 files changed

+44
-193
lines changed

5 files changed

+44
-193
lines changed

.github/workflows/docat.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ jobs:
2727
- name: run backend linter
2828
working-directory: docat
2929
run: |
30-
python -m poetry run flake8 docat tests
30+
python -m poetry ruff check
31+
python -m poetry ruff format --check
3132
3233
- name: run backend static code analysis
3334
working-directory: docat

docat/.flake8

Lines changed: 0 additions & 3 deletions
This file was deleted.

docat/Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
format:
2-
poetry run isort docat tests
3-
poetry run black docat tests
2+
poetry run ruff check --fix
3+
poetry run ruff format
44
lint:
5-
poetry run flake8 docat tests
5+
poetry run ruff check
66
pytest:
77
poetry run pytest

docat/poetry.lock

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

docat/pyproject.toml

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,7 @@ uvicorn = "^0.30.1"
1414
python-magic = "^0.4.27"
1515

1616
[tool.poetry.dev-dependencies]
17-
flake8 = "^7.1.0"
18-
flake8-isort = "^6.1.1"
19-
flake8-black = "^0.3.6"
17+
ruff = "^0.6.9"
2018
pytest = "^8.2.2"
2119
pytest-cov = "^5.0.0"
2220
requests = "^2.32.3"
@@ -33,14 +31,6 @@ testpaths = [
3331
requires = ["poetry-core>=1.0.0"]
3432
build-backend = "poetry.core.masonry.api"
3533

36-
[tool.isort]
37-
multi_line_output = 3
38-
include_trailing_comma = true
39-
force_grid_wrap = 0
40-
use_parentheses = true
41-
ensure_newline_before_comments = true
42-
line_length = 140
43-
4434
[[tool.mypy.overrides]]
4535
module = [
4636
"tinydb",
@@ -49,5 +39,14 @@ module = [
4939
]
5040
ignore_missing_imports = true
5141

52-
[tool.black]
42+
[tool.ruff]
5343
line-length = 140
44+
# Rule descriptions: https://docs.astral.sh/ruff/rules/
45+
lint.select = ["I", "E", "B", "F", "W", "N", "C4", "C90", "ARG", "PL", "RUF", "UP"]
46+
# TODO: Should be reduct to no global exceptions
47+
lint.ignore = ["B008", "N806", "PLR0911", "PLR0913"]
48+
49+
[tool.ruff.lint.per-file-ignores]
50+
# Ignore for all tests (Magic value used in comparison)
51+
# We use magic values in tests
52+
"tests/*" = ["PLR2004"]

0 commit comments

Comments
 (0)