-
Notifications
You must be signed in to change notification settings - Fork 247
Expand file tree
/
Copy pathMakefile
More file actions
31 lines (25 loc) · 936 Bytes
/
Makefile
File metadata and controls
31 lines (25 loc) · 936 Bytes
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
.PHONY: quality style quality-full style-full test
check_dirs := src tests examples
changed_python_files := $(shell (git diff --name-only --diff-filter=ACMR HEAD -- $(check_dirs); git ls-files --others --exclude-standard -- $(check_dirs)) 2>/dev/null | awk '/\.py$$/' | sort -u)
quality-full:
ruff check $(check_dirs) # linter
ruff format --check $(check_dirs) # formatter
style-full:
ruff check --fix $(check_dirs) # linter
ruff format $(check_dirs) # formatter
quality:
ifeq ($(strip $(changed_python_files)),)
@echo "No changed Python files in $(check_dirs)."
else
ruff check $(changed_python_files) # linter
ruff format --check $(changed_python_files) # formatter
endif
style:
ifeq ($(strip $(changed_python_files)),)
@echo "No changed Python files in $(check_dirs)."
else
ruff check --fix $(changed_python_files) # linter
ruff format $(changed_python_files) # formatter
endif
test:
python -m pytest -sv ./tests/