-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Expand file tree
/
Copy pathMakefile
More file actions
77 lines (64 loc) · 1.83 KB
/
Makefile
File metadata and controls
77 lines (64 loc) · 1.83 KB
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
SHELL := /bin/bash
PY_MODULE := slither
TEST_MODULE := tests
SCRIPT_MODULE := scripts
# Optionally overridden by the user in the `test` target.
TESTS :=
# If the user selects a specific test pattern to run, set `pytest` to fail fast
# and only run tests that match the pattern.
ifneq ($(TESTS),)
TEST_ARGS := -x -k $(TESTS)
else
TEST_ARGS := -n auto
endif
.PHONY: help
help:
@echo "Usage: make [target]"
@echo ""
@echo "Setup:"
@echo " dev Install dependencies and pre-commit hooks"
@echo ""
@echo "Development:"
@echo " lint Run all linters (ruff, yamllint, actionlint, zizmor)"
@echo " reformat Auto-fix lint issues and format code"
@echo " test Run test suite (use TESTS=pattern to filter)"
@echo " check Run lint + test"
@echo " run Run slither (use ARGS='...' to pass arguments)"
@echo ""
@echo "Build:"
@echo " doc Generate documentation"
@echo " package Build distribution package"
@echo " clean Remove build artifacts and caches"
.PHONY: dev
dev:
uv sync --group dev
prek install
.PHONY: run
run:
uv run slither $(ARGS)
.PHONY: lint
lint:
uv run ruff check $(PY_MODULE) $(TEST_MODULE) $(SCRIPT_MODULE)
uv run yamllint -c .yamllint .github/
actionlint
zizmor .github/workflows/
.PHONY: reformat
reformat:
uv run ruff check --fix $(PY_MODULE) $(TEST_MODULE) $(SCRIPT_MODULE)
uv run ruff format $(PY_MODULE) $(TEST_MODULE) $(SCRIPT_MODULE)
.PHONY: test tests
test tests:
uv run pytest --cov=$(PY_MODULE) $(T) $(TEST_ARGS)
uv run coverage report -m
.PHONY: check
check: lint test
.PHONY: doc
doc:
PDOC_ALLOW_EXEC=1 uv run pdoc -o html slither '!slither.tools'
.PHONY: package
package:
uv build
.PHONY: clean
clean:
rm -rf .venv/ build/ dist/ *.egg-info/ .pytest_cache/ .coverage htmlcov/ html/
find . -type d -name __pycache__ -exec rm -rf {} + 2>/dev/null || true