diff --git a/.githooks/pre-commit b/.githooks/pre-commit new file mode 100755 index 0000000..be47b3c --- /dev/null +++ b/.githooks/pre-commit @@ -0,0 +1,14 @@ +#!/usr/bin/env bash +set -euo pipefail + +repo_root="$(git rev-parse --show-toplevel)" +cd "$repo_root" + +echo "[pre-commit] Running make format..." +make format + +echo "[pre-commit] Staging formatting changes..." +git add -A + +echo "[pre-commit] Running make lint..." +make lint diff --git a/Makefile b/Makefile index a56c468..8938244 100644 --- a/Makefile +++ b/Makefile @@ -30,6 +30,14 @@ help: @echo " make clean Remove build artifacts" @echo " make format Format QML, C++, JSON, YAML, and Markdown files" @echo " make lint Run non-mutating lint and formatting checks" + @echo " make hooks-install Configure Git to use versioned hooks from .githooks/" + +# Git Hooks +# Configure Git to use versioned hooks stored in this repository. +.PHONY: hooks-install +hooks-install: + git config core.hooksPath .githooks + @echo "Configured core.hooksPath=.githooks" # C++ Bridge Build Targets # Generate CMake build files for the C++ QML bridge. diff --git a/README.md b/README.md index ee0d969..067fc5e 100644 --- a/README.md +++ b/README.md @@ -24,14 +24,15 @@ sudo pacman -S plasma-sdk inotify-tools kirigami2 qt6-base qt6-declarative ## Quick Start 1. Clone this repository. -2. If you use VS Code, run `make cpp-build` once to build the C++ bridge and generate IDE metadata for autocomplete. Then install the official QML extension and reload the VS Code window. -3. Start hot reload while editing with `make watch`. -4. Install a symlinked development version with `make dev-install`. -5. For a normal local install (non-symlinked), use `make install`. -6. Check style/lint status with `make lint`. -7. Format everything with `make format`. -8. Test in different modes with `make test`, `make test-panel`, `make test-desktop`, or `make test-hidpi`. -9. Package for distribution with `make package` (creates `build/.plasmoid`, default: `build/org.kde.plasma.starter.plasmoid`). This is just a zip file with a different extension, so you can inspect it with any archive manager. +2. Run `make hooks-install` once to enable Git hooks from `.githooks/`. +3. If you use VS Code, run `make cpp-build` once to build the C++ bridge and generate IDE metadata for autocomplete. Then install the official QML extension and reload the VS Code window. +4. Start hot reload while editing with `make watch`. +5. Install a symlinked development version with `make dev-install`. +6. For a normal local install (non-symlinked), use `make install`. +7. Check style/lint status with `make lint`. +8. Format everything with `make format`. +9. Test in different modes with `make test`, `make test-panel`, `make test-desktop`, or `make test-hidpi`. +10. Package for distribution with `make package` (creates `build/.plasmoid`, default: `build/org.kde.plasma.starter.plasmoid`). This is just a zip file with a different extension, so you can inspect it with any archive manager. ## Editor Setup Notes