|
| 1 | +# Variables for reusable values |
| 2 | +PACKAGE := eventsourcingdb |
| 3 | +TEST_DIR := tests |
| 4 | +PYTHON_DIRS := $(PACKAGE) $(TEST_DIR) |
| 5 | + |
| 6 | +# Default target and help |
| 7 | +.DEFAULT_GOAL := help |
| 8 | +help: |
| 9 | + @echo "Available commands:" |
| 10 | + @echo " qa : Run analysis and tests" |
| 11 | + @echo " analyze : Run code analysis with ruff" |
| 12 | + @echo " format : Format code" |
| 13 | + @echo " test : Run tests" |
| 14 | + @echo " coverage : Check test coverage" |
| 15 | + @echo " lock : Lock dependencies with uv" |
| 16 | + @echo " clean : Remove temporary files" |
| 17 | + @echo " build : Run QA and prepare build" |
| 18 | + |
1 | 19 | qa: analyze test |
2 | 20 |
|
3 | 21 | analyze: |
4 | | - @poetry run pylint eventsourcingdb tests |
| 22 | + @echo "Running code analysis..." |
| 23 | + @uv run ruff $(PYTHON_DIRS) |
5 | 24 |
|
6 | 25 | format: |
7 | | - @poetry run autopep8 --in-place --aggressive --max-line-length=100 --recursive eventsourcingdb tests |
8 | | - |
| 26 | + @echo "Formatting code..." |
| 27 | + @uv run ruff format --in-place --aggressive --max-line-length=100 --recursive $(PYTHON_DIRS) |
| 28 | + |
9 | 29 | lock: |
10 | | - @poetry lock |
| 30 | + @echo "Updating dependency lock..." |
| 31 | + @uv run uv lock |
11 | 32 |
|
12 | 33 | test: |
13 | | - @poetry run pytest --maxfail=1 |
| 34 | + @echo "Running tests..." |
| 35 | + @uv run pytest --maxfail=1 |
| 36 | + |
| 37 | +coverage: |
| 38 | + @echo "Checking test coverage..." |
| 39 | + @uv run pytest --cov=$(PACKAGE) --cov-report=term-missing $(TEST_DIR) |
14 | 40 |
|
15 | 41 | clean: |
| 42 | + @echo "Cleaning up..." |
| 43 | + @find . -type d -name __pycache__ -exec rm -rf {} + |
| 44 | + @find . -type f -name "*.pyc" -delete |
| 45 | + @find . -type f -name "*.pyo" -delete |
| 46 | + @find . -type f -name "*.pyd" -delete |
| 47 | + @find . -type f -name ".coverage" -delete |
| 48 | + @find . -type d -name "*.egg-info" -exec rm -rf {} + |
| 49 | + @find . -type d -name "*.egg" -exec rm -rf {} + |
| 50 | + @find . -type d -name ".pytest_cache" -exec rm -rf {} + |
| 51 | + @rm -rf build/ dist/ .coverage htmlcov/ |
16 | 52 |
|
17 | 53 | build: qa clean |
| 54 | + @echo "Build prepared." |
18 | 55 |
|
19 | | -.PHONY: analyze build clean format lock qa test |
| 56 | +.PHONY: analyze build clean format lock qa test coverage help |
0 commit comments