Skip to content

Commit

Permalink
Switch from black and flake8 to ruff
Browse files Browse the repository at this point in the history
  • Loading branch information
fliiiix committed Oct 10, 2024
1 parent 475e4a1 commit 8d873c1
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 193 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/docat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ jobs:
- name: run backend linter
working-directory: docat
run: |
python -m poetry run flake8 docat tests
python -m poetry ruff check
python -m poetry ruff format --check
- name: run backend static code analysis
working-directory: docat
Expand Down
3 changes: 0 additions & 3 deletions docat/.flake8

This file was deleted.

6 changes: 3 additions & 3 deletions docat/Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
format:
poetry run isort docat tests
poetry run black docat tests
poetry run ruff check --fix
poetry run ruff format
lint:
poetry run flake8 docat tests
poetry run ruff check
pytest:
poetry run pytest
202 changes: 28 additions & 174 deletions docat/poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 11 additions & 12 deletions docat/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@ uvicorn = "^0.30.1"
python-magic = "^0.4.27"

[tool.poetry.dev-dependencies]
flake8 = "^7.1.0"
flake8-isort = "^6.1.1"
flake8-black = "^0.3.6"
ruff = "^0.6.9"
pytest = "^8.2.2"
pytest-cov = "^5.0.0"
requests = "^2.32.3"
Expand All @@ -33,14 +31,6 @@ testpaths = [
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"

[tool.isort]
multi_line_output = 3
include_trailing_comma = true
force_grid_wrap = 0
use_parentheses = true
ensure_newline_before_comments = true
line_length = 140

[[tool.mypy.overrides]]
module = [
"tinydb",
Expand All @@ -49,5 +39,14 @@ module = [
]
ignore_missing_imports = true

[tool.black]
[tool.ruff]
line-length = 140
# Rule descriptions: https://docs.astral.sh/ruff/rules/
lint.select = ["I", "E", "B", "F", "W", "N", "C4", "C90", "ARG", "PL", "RUF", "UP"]
# TODO: Should be reduct to no global exceptions
lint.ignore = ["B008", "N806", "PLR0911", "PLR0913"]

[tool.ruff.lint.per-file-ignores]
# Ignore for all tests (Magic value used in comparison)
# We use magic values in tests
"tests/*" = ["PLR2004"]

0 comments on commit 8d873c1

Please sign in to comment.