diff --git a/Makefile b/Makefile index b016433..2b250b3 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -.PHONY: build clean validate test all schemas schema-validate +.PHONY: build clean validate test all schemas schema-validate lint DIST := dist SRC := src @@ -21,6 +21,12 @@ endif uv run x4cat extract "$(X4_GAME_DIR)" -o $(SCHEMAS) -g '*.xsd' @echo "Schemas extracted to $(SCHEMAS)/" +lint: +ifndef X4_GAME_DIR + $(error X4_GAME_DIR not set — e.g. make lint X4_GAME_DIR="/path/to/X4 Foundations") +endif + uv run x4cat validate-diff "$(X4_GAME_DIR)" $(SRC) + schema-validate: uv run pytest tests/test_mod.py::TestSchema -q diff --git a/README.md b/README.md index 6adf635..6661355 100644 --- a/README.md +++ b/README.md @@ -35,6 +35,18 @@ make test # full test suite (includes build verification) make clean # remove dist/ ``` +## Diff patch linting + +Validate that all XML diff patches in `src/` have XPath selectors that match +the base game files they target: + +```bash +make lint X4_GAME_DIR="/path/to/X4 Foundations" +``` + +Reports mismatches with file path, line number, and the failing XPath. +Skipped gracefully when no diff patches exist in `src/`. + ## Schema validation Optionally extract XSD schemas from your X4 install for full schema validation diff --git a/uv.lock b/uv.lock index edc620d..5f48264 100644 --- a/uv.lock +++ b/uv.lock @@ -149,4 +149,4 @@ wheels = [ [[package]] name = "x4cat" version = "0.1.0" -source = { git = "https://github.com/meethune/x4cat.git#346da177d5fa31b9d52361c9f54ad262c8c88e0a" } +source = { git = "https://github.com/meethune/x4cat.git#b0e17e142f05ef56aa4859b5d253d317a307b9b7" }