-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
101 lines (84 loc) · 2.68 KB
/
Makefile
File metadata and controls
101 lines (84 loc) · 2.68 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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
.PHONY: help install generate lint check test coverage compliance docs docs-serve clean
GRAMMAR_DIR := grammars
GENERATED_DIR := generated
help:
@echo "Usage: make [target]"
@echo ""
@echo "Targets:"
@echo " install Install Python dependencies"
@echo " generate Generate ANTLR parsers (Python)"
@echo " lint Format and lint code"
@echo " check Check code without fixing"
@echo " test Run parser tests"
@echo " coverage Run tests with coverage report"
@echo " compliance Run HL7 CQL/FHIRPath compliance tests"
@echo " docs Build documentation"
@echo " docs-serve Serve documentation locally"
@echo " clean Remove generated files and caches"
install:
@echo ">>> Installing Python dependencies"
@uv sync
# Generate both parsers - fhirpath first since cql imports it
generate: generate-fhirpath generate-cql
generate-fhirpath:
@echo ">>> Generating FHIRPath Python parser"
@mkdir -p $(GENERATED_DIR)/fhirpath
@cd $(GRAMMAR_DIR) && antlr -Dlanguage=Python3 -visitor \
-o ../$(GENERATED_DIR)/fhirpath \
fhirpath.g4
generate-cql:
@echo ">>> Generating CQL Python parser"
@mkdir -p $(GENERATED_DIR)/cql
@cd $(GRAMMAR_DIR) && antlr -Dlanguage=Python3 -visitor \
-o ../$(GENERATED_DIR)/cql \
cql.g4
lint:
@echo ">>> Formatting and linting"
@uv run ruff format .
@uv run ruff check . --fix
@echo ">>> Running mypy"
@uv run mypy src
@echo ">>> Running pyright"
@uv run pyright
check:
@echo ">>> Checking code"
@uv run ruff check .
@uv run ruff format --check .
@uv run mypy src
@uv run pyright
test:
@echo ">>> Running tests"
@uv run pytest tests/ -v
coverage:
@echo ">>> Running tests with coverage"
@uv run pytest tests/ --cov=src/fhirkit --cov-report=term-missing --cov-report=html
@echo ">>> HTML report generated in htmlcov/"
compliance:
@echo ">>> Running HL7 CQL/FHIRPath compliance tests"
@uv run pytest tests/compliance/ -v --tb=short 2>&1 | tee compliance-report.txt
@echo ">>> Report saved to compliance-report.txt"
compliance-cql:
@echo ">>> Running CQL compliance tests"
@uv run pytest tests/compliance/cql/ -v --tb=short
compliance-fhirpath:
@echo ">>> Running FHIRPath compliance tests"
@uv run pytest tests/compliance/fhirpath/ -v --tb=short
docs:
@echo ">>> Building documentation"
@uv run --group docs mkdocs build
docs-serve:
@echo ">>> Serving documentation at http://127.0.0.1:8000"
@uv run --group docs mkdocs serve
clean:
@echo ">>> Cleaning"
@rm -rf $(GENERATED_DIR)
@rm -rf .ruff_cache
@rm -rf .mypy_cache
@rm -rf .pytest_cache
@rm -rf .coverage
@rm -rf htmlcov
@rm -rf coverage.xml
@rm -rf site
@rm -rf .venv
@find . -type d -name "__pycache__" -exec rm -rf {} + 2>/dev/null || true
.DEFAULT_GOAL := help