mirror of
https://github.com/freedomofpress/dangerzone.git
synced 2025-04-28 18:02:38 +02:00
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`.
This commit is contained in:
parent
7624624471
commit
e96b44e10a
1 changed files with 8 additions and 19 deletions
27
Makefile
27
Makefile
|
@ -2,22 +2,6 @@ LARGE_TEST_REPO_DIR:=tests/test_docs_large
|
||||||
GIT_DESC=$$(git describe)
|
GIT_DESC=$$(git describe)
|
||||||
JUNIT_FLAGS := --capture=sys -o junit_logging=all
|
JUNIT_FLAGS := --capture=sys -o junit_logging=all
|
||||||
|
|
||||||
.PHONY: lint-black
|
|
||||||
lint-black: ## check python source code formatting issues, with black
|
|
||||||
black --check --diff ./
|
|
||||||
|
|
||||||
.PHONY: lint-black-apply
|
|
||||||
lint-black-apply: ## apply black's source code formatting suggestions
|
|
||||||
black ./
|
|
||||||
|
|
||||||
.PHONY: lint-isort
|
|
||||||
lint-isort: ## check imports are organized, with isort
|
|
||||||
isort --check --diff ./
|
|
||||||
|
|
||||||
.PHONY: lint-isort-apply
|
|
||||||
lint-isort-apply: ## apply isort's imports organization suggestions
|
|
||||||
isort ./
|
|
||||||
|
|
||||||
MYPY_ARGS := --ignore-missing-imports \
|
MYPY_ARGS := --ignore-missing-imports \
|
||||||
--disallow-incomplete-defs \
|
--disallow-incomplete-defs \
|
||||||
--disallow-untyped-defs \
|
--disallow-untyped-defs \
|
||||||
|
@ -35,10 +19,15 @@ mypy-tests:
|
||||||
mypy: mypy-host mypy-tests ## check type hints with mypy
|
mypy: mypy-host mypy-tests ## check type hints with mypy
|
||||||
|
|
||||||
.PHONY: lint
|
.PHONY: lint
|
||||||
lint: lint-black lint-isort mypy ## check the code with various linters
|
lint: ## Check the code for linting, formatting, and typing issues with ruff and mypy
|
||||||
|
ruff check
|
||||||
|
ruff format --check
|
||||||
|
mypy
|
||||||
|
|
||||||
.PHONY: lint-apply
|
.PHONY: fix
|
||||||
format: lint-black-apply lint-isort-apply ## apply all the linter's suggestions
|
fix: ## apply all the suggestions from ruff
|
||||||
|
ruff check --fix
|
||||||
|
ruff format
|
||||||
|
|
||||||
.PHONY: test
|
.PHONY: test
|
||||||
test:
|
test:
|
||||||
|
|
Loading…
Reference in a new issue