-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
49 lines (34 loc) · 1.03 KB
/
Copy pathMakefile
File metadata and controls
49 lines (34 loc) · 1.03 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
.PHONY: install gate lint format types security deadcode audit test \
sbom sbom-score sbom-verify lock all
VENV ?= venv
PY := $(VENV)/bin/python
SBOM := sbom.cdx.json
SBOM_MIN_SCORE ?= 9.0
install:
$(PY) -m pip install -e ".[dev]"
lint:
$(PY) -m ruff check .
format:
$(PY) -m black --check --diff .
types:
$(PY) -m mypy
security:
$(PY) -m bandit -rq src -c pyproject.toml
deadcode:
$(PY) -m vulture src/
audit:
$(PY) -m pip_audit -r requirements.lock --strict
test:
$(PY) -m pytest
gate: lint format types security deadcode test
lock:
uv pip compile pyproject.toml --generate-hashes -o requirements.lock
sbom:
$(PY) scripts/generate_sbom.py --sign --output $(SBOM)
sbom-verify:
$(PY) scripts/verify_sbom.py $(SBOM)
sbom-score: sbom
sbomqs score $(SBOM)
@score=$$(sbomqs score $(SBOM) --basic | cut -f1); \
awk -v s=$$score -v m=$(SBOM_MIN_SCORE) 'BEGIN { if (s+0 < m+0) { printf "SBOM score %.1f below minimum %.1f\n", s, m; exit 1 } printf "SBOM score %.1f >= %.1f OK\n", s, m }'
all: gate sbom-score sbom-verify