Compare commits

..

7 commits

Author SHA1 Message Date
jkarasti
41a6c59634 Lint: Enable isort (I) rules 2024-12-02 19:09:11 +02:00
jkarasti
3e43ab6492 Lint: Fix unused-variable (F841) 2024-12-02 19:09:11 +02:00
jkarasti
c3920a5a1c Lint: Fix f-string-missing-placeholders (F541) 2024-12-02 19:09:11 +02:00
jkarasti
c2231b4fef Lint: Fix unused-import (F401) 2024-12-02 19:09:11 +02:00
jkarasti
88931d8452 Format: Run ruff format over the source code 2024-12-02 19:09:11 +02:00
jkarasti
1de201e03f Lint: Remove unused black and isort dependencies 2024-12-02 19:09:11 +02:00
jkarasti
6cd736de69 Lint: adapt Makefile targets for ruff
- Add new targets for checking and applying `ruff check` and `ruff format`.

- Add targets `fix` and `check` for convenience.

- Also use the new `check` target in CI.
2024-12-02 19:07:45 +02:00
2 changed files with 23 additions and 8 deletions

View file

@ -38,7 +38,7 @@ jobs:
apt-get install -y git make python3 python3-poetry --no-install-recommends
poetry install --only lint,test
- name: Run linters to enforce code style
run: poetry run make lint
run: poetry run make check
- name: Check that the QA script is up to date with the docs
run: "./dev_scripts/qa.py --check-refs"

View file

@ -1,6 +1,19 @@
LARGE_TEST_REPO_DIR:=tests/test_docs_large
GIT_DESC=$$(git describe)
JUNIT_FLAGS := --capture=sys -o junit_logging=all
lint-ruff: ## check the python source code with various linter rules through ruff
ruff check
lint-ruff-apply: ## apply all fixes made by ruff to the source code
ruff check --fix
format-ruff: ## Check the formatting of the python source code with ruff
ruff format --check
format-ruff-apply: ## apply all the formatting suggestions from ruff
ruff format
MYPY_ARGS := --ignore-missing-imports \
--disallow-incomplete-defs \
--disallow-untyped-defs \
@ -9,17 +22,19 @@ MYPY_ARGS := --ignore-missing-imports \
--warn-unused-ignores \
--exclude $(LARGE_TEST_REPO_DIR)/*.py
.PHONY: lint
lint: ## Check the code for linting, formatting, and typing issues with ruff and mypy
ruff check
ruff format --check
mypy-host:
mypy $(MYPY_ARGS) dangerzone
mypy-tests:
mypy $(MYPY_ARGS) tests
mypy: mypy-host mypy-tests ## check type hints with mypy
.PHONY: check
check: lint-ruff format-ruff mypy ## check the code with ruff and mypy
.PHONY: fix
fix: ## apply all the suggestions from ruff
ruff check --fix
ruff format
fix: lint-ruff-apply format-ruff-apply ## apply all the suggestions from ruff
.PHONY: test
test: