-
Notifications
You must be signed in to change notification settings - Fork 16
/
Makefile
63 lines (53 loc) · 1.73 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# Directories
SRC_PATHS := fast_plate_ocr/ test/
# Tasks
.PHONY: help
help:
@echo "Available targets:"
@echo " help : Show this help message"
@echo " format : Format code using Ruff format"
@echo " check_format : Check code formatting with Ruff format"
@echo " ruff : Run Ruff linter"
@echo " pylint : Run Pylint linter"
@echo " mypy : Run MyPy static type checker"
@echo " lint : Run linters (Ruff, Pylint and Mypy)"
@echo " test : Run tests using pytest"
@echo " checks : Check format, lint, and test"
@echo " clean : Clean up caches and build artifacts"
.PHONY: format
format:
@echo "==> Sorting imports..."
@# Currently, the Ruff formatter does not sort imports, see https://docs.astral.sh/ruff/formatter/#sorting-imports
@poetry run ruff check --select I --fix $(SRC_PATHS)
@echo "=====> Formatting code..."
@poetry run ruff format $(SRC_PATHS)
.PHONY: check_format
check_format:
@echo "=====> Checking format..."
@poetry run ruff format --check --diff $(SRC_PATHS)
@echo "=====> Checking imports are sorted..."
@poetry run ruff check --select I --exit-non-zero-on-fix $(SRC_PATHS)
.PHONY: ruff
ruff:
@echo "=====> Running Ruff..."
@poetry run ruff check $(SRC_PATHS)
.PHONY: pylint
pylint:
@echo "=====> Running Pylint..."
@poetry run pylint $(SRC_PATHS)
.PHONY: mypy
mypy:
@echo "=====> Running Mypy..."
@poetry run mypy $(SRC_PATHS)
.PHONY: lint
lint: ruff pylint mypy
.PHONY: test
test:
@echo "=====> Running tests..."
@poetry run pytest test/
.PHONY: clean
clean:
@echo "=====> Cleaning caches..."
@poetry run ruff clean
@rm -rf .cache .pytest_cache .mypy_cache build dist *.egg-info
checks: format lint test