mirror of
https://github.com/freedomofpress/dangerzone.git
synced 2025-05-06 13:31:50 +02:00
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.
This commit is contained in:
parent
8cf2246855
commit
6cd736de69
2 changed files with 13 additions and 17 deletions
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
|
@ -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"
|
||||
|
||||
|
|
28
Makefile
28
Makefile
|
@ -2,21 +2,17 @@ LARGE_TEST_REPO_DIR:=tests/test_docs_large
|
|||
GIT_DESC=$$(git describe)
|
||||
JUNIT_FLAGS := --capture=sys -o junit_logging=all
|
||||
|
||||
.PHONY: lint-black
|
||||
lint-black: ## check python source code formatting issues, with black
|
||||
black --check --diff ./
|
||||
lint-ruff: ## check the python source code with various linter rules through ruff
|
||||
ruff check
|
||||
|
||||
.PHONY: lint-black-apply
|
||||
lint-black-apply: ## apply black's source code formatting suggestions
|
||||
black ./
|
||||
lint-ruff-apply: ## apply all fixes made by ruff to the source code
|
||||
ruff check --fix
|
||||
|
||||
.PHONY: lint-isort
|
||||
lint-isort: ## check imports are organized, with isort
|
||||
isort --check --diff ./
|
||||
format-ruff: ## Check the formatting of the python source code with ruff
|
||||
ruff format --check
|
||||
|
||||
.PHONY: lint-isort-apply
|
||||
lint-isort-apply: ## apply isort's imports organization suggestions
|
||||
isort ./
|
||||
format-ruff-apply: ## apply all the formatting suggestions from ruff
|
||||
ruff format
|
||||
|
||||
MYPY_ARGS := --ignore-missing-imports \
|
||||
--disallow-incomplete-defs \
|
||||
|
@ -34,11 +30,11 @@ mypy-tests:
|
|||
|
||||
mypy: mypy-host mypy-tests ## check type hints with mypy
|
||||
|
||||
.PHONY: lint
|
||||
lint: lint-black lint-isort mypy ## check the code with various linters
|
||||
.PHONY: check
|
||||
check: lint-ruff format-ruff mypy ## check the code with ruff and mypy
|
||||
|
||||
.PHONY: lint-apply
|
||||
format: lint-black-apply lint-isort-apply ## apply all the linter's suggestions
|
||||
.PHONY: fix
|
||||
fix: lint-ruff-apply format-ruff-apply ## apply all the suggestions from ruff
|
||||
|
||||
.PHONY: test
|
||||
test:
|
||||
|
|
Loading…
Reference in a new issue