Improve slugify function, add tests, and enhance Makefile
Applied improvements from feature-code-quality branch: - Refactored slugify() for better readability with inline comments - Renamed log() parameter *args to *log_args (avoid shadowing built-in) - Added comprehensive unit tests for slugify function - Enhanced Makefile with typecheck and test targets - Updated build target to run type checks and tests before Docker build All tests pass and type checking succeeds.
This commit is contained in:
parent
13d3d653de
commit
3297ce5e67
4 changed files with 38 additions and 14 deletions
23
Makefile
23
Makefile
|
|
@ -1,15 +1,28 @@
|
|||
# Makefile
|
||||
# Makefile
|
||||
|
||||
# build target should be built even if no files depend on it
|
||||
.PHONY: build
|
||||
# declare phony targets
|
||||
.PHONY: build test typecheck
|
||||
|
||||
# run locally
|
||||
site:
|
||||
site:
|
||||
uv run python makesite.py --params params-local.json
|
||||
cd _site && python -m SimpleHTTPServer 2> /dev/null || python3 -m http.server
|
||||
|
||||
# run type checks
|
||||
typecheck:
|
||||
uv run mypy makesite.py monitor.py
|
||||
|
||||
# run unit tests
|
||||
test:
|
||||
uv run python -m unittest discover test -v
|
||||
|
||||
# docker build image
|
||||
build:
|
||||
build:
|
||||
@echo "Running type checks..."
|
||||
uv run mypy makesite.py monitor.py
|
||||
@echo "Running tests..."
|
||||
uv run python -m unittest discover test -v
|
||||
@echo "Building Docker image..."
|
||||
docker build -t source.madyanne.fr/yax/blog .
|
||||
|
||||
# docker publish image
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue