Skip to content

Commit

Permalink
Add some Ruff ignores, enable it in GH Actions
Browse files Browse the repository at this point in the history
It's only reporting errors for now, I'll make it mandatory after having
fixed or ignore a lot of errors :)
  • Loading branch information
scy committed Feb 7, 2024
1 parent 9cee938 commit 0870db9
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ jobs:
sudo apt install -y graphviz graphviz-dev python3-dev
python -m pip install poetry
poetry install --all-extras
- name: Lint with Ruff
run: poetry run ruff
continue-on-error: true # temporary, until we've updated the codebase to Ruff's standards
- name: Typecheck with mypy
run: poetry run mypy
- name: Test with pytest
Expand Down
18 changes: 18 additions & 0 deletions server/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,11 @@ markers = [
[tool.ruff]
line-length = 79
indent-width = 4
target-version = "py38"
exclude = [
".git",
"migrations",
]

[tool.ruff.format]
quote-style = "double"
Expand Down Expand Up @@ -129,10 +134,23 @@ ignore = [
"ANN102", # type annotation for @classmethod first argument
"ISC001", # conflict w/ formatter, see https://github.com/astral-sh/ruff/issues/8272
"PLC0415", # forbids dynamic imports
"PT006", # forbids comma-separated string for @pytest.mark.parametrize names
"PT007", # forbids non-list types for @pytest.mark.parametrize values
"RUF001", # complains about Unicode typography in strings
"RUF002", # complains about Unicode typography in docstrings
"RUF200", # requires a name for projects
"TRY003", # complains about simple ValueError messages
]

[tool.ruff.lint.isort]
# Two blank lines after the imports.
lines-after-imports = 2

[tool.ruff.lint.per-file-ignores]
"tests/*" = [
"ANN001", # missing function argument annotation
"ANN201", # missing return type annotation
"ARG001", # unused function argument (e.g. require-only fixtures)
"INP001", # implicit namespace package
"S101", # use of assert
]
2 changes: 1 addition & 1 deletion server/test.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/bin/sh

poetry run sh -c 'ruff check && mypy && mypy tests && pytest && dearmep check translations'
poetry run sh -c 'ruff check; mypy && mypy tests && pytest && dearmep check translations'

0 comments on commit 0870db9

Please sign in to comment.