Compare commits

..

8 commits

Author SHA1 Message Date
jkarasti
87eac56345 Lint: Enable isort (I) rules 2024-12-05 21:46:11 +02:00
jkarasti
688bc991ab Lint: Fix unused-variable (F841) 2024-12-05 21:46:11 +02:00
jkarasti
5ad8092a2c Lint: Fix f-string-missing-placeholders (F541) 2024-12-05 21:46:11 +02:00
jkarasti
9764a1b3f2 Lint: Fix unused-import (F401) 2024-12-05 21:46:11 +02:00
jkarasti
5d4d8ed441 Format: Run ruff format over the source code 2024-12-05 21:46:11 +02:00
jkarasti
75bbfea6ce Lint: Remove unused black and isort dependencies 2024-12-05 21:46:11 +02:00
jkarasti
0f8382b831 Lint: Merge mypy makefile targets into the lint target 2024-12-05 21:46:11 +02:00
jkarasti
19915fda50 Lint: adapt Makefile targets for ruff
- Use `ruff` instead of `black` and `isort` in the `lint` target for linting and code formatting.

- Add a new target `fix` which applies all suggestions from `ruff check` and `ruff format`.
2024-12-05 20:33:10 +02:00
2 changed files with 8 additions and 23 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 check
run: poetry run make lint
- name: Check that the QA script is up to date with the docs
run: "./dev_scripts/qa.py --check-refs"

View file

@ -1,19 +1,6 @@
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 \
@ -22,19 +9,17 @@ MYPY_ARGS := --ignore-missing-imports \
--warn-unused-ignores \
--exclude $(LARGE_TEST_REPO_DIR)/*.py
mypy-host:
.PHONY: lint
lint: ## Check the code for linting, formatting, and typing issues with ruff and mypy
ruff check
ruff format --check
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: lint-ruff-apply format-ruff-apply ## apply all the suggestions from ruff
fix: ## apply all the suggestions from ruff
ruff check --fix
ruff format
.PHONY: test
test: