feat(git): add pre-commit hook and optimize test script for local path execution

This commit streamlines the local developer workflow by enforcing automated quality
checks pre-commit and speeding up test execution when development tools are present
in the environment $PATH.

- Add `.githooks/pre-commit` hook to automatically run the verification suite via `scripts/test` before committing.
- Update `scripts/test` to check for locally available commands (`luacheck`, `ruff`, `pyright`) in PATH before falling back to `nix-shell`.
- Add `luaPackages.luacheck` to developer packages in `home/dev.nix`.
- Routine lockfile input revisions (`flake.lock`) update for: DankMaterialShell, dankcalendar, and home-manager.
This commit is contained in:
kiskaadee committed 2026-09-14 19:33:30 -05:00
1 parent ff5394c7b2
commit 4dc97abef9
4 files changed
+35 -12

No files matched your search

+12
View File
@@ -0,0 +1,12 @@
#!/usr/bin/env bash
# .githooks/pre-commit - Git pre-commit hook running automated quality checks
set -euo pipefail
# Ensure NixOS user profile binaries are in PATH
export PATH="/etc/profiles/per-user/${USER:-kiskaadee}/bin:$HOME/.nix-profile/bin:$PATH"
REPO_ROOT="$(git rev-parse --show-toplevel)"
cd "$REPO_ROOT"
echo "🚀 [pre-commit] Running automated verification & static analysis suite..."
exec "$REPO_ROOT/scripts/test"
Generated
+12 -12
View File
@@ -61,11 +61,11 @@
"dank-qml-common_2": {
"flake": false,
"locked": {
"lastModified": 1788219423,
"narHash": "sha256-U4WBPh+pfM2IRF+IOWWHaw3cWaR1kYtl+Rdp7i9S2OQ=",
"lastModified": 1789422809,
"narHash": "sha256-xfWdZ5WFluH0hcDiLrVacJok/1n/+u3wTt8rKe1xlQc=",
"owner": "AvengeMedia",
"repo": "dank-qml-common",
"rev": "a9ae19facd460a4150da269dafcfb044b0dd9eea",
"rev": "e145d7857264daa0359f83aa5cd382d76742a1bd",
"type": "github"
},
"original": {
@@ -98,11 +98,11 @@
]
},
"locked": {
"lastModified": 1789325878,
"narHash": "sha256-lpgXRZ3SUtTBBsk3/hqlRtva82aI7dHxzbQsunj7oIY=",
"lastModified": 1789423018,
"narHash": "sha256-ZUEdR12HguRVDETMW9AxOjwI0oJyQsp80bmi7gdJtsA=",
"owner": "AvengeMedia",
"repo": "dankcalendar",
"rev": "2f811b14f973521a67af7c71a6a26a9cc42cdada",
"rev": "2cfcbf342ea0c8007e7b0491a3e2a1f05c413964",
"type": "github"
},
"original": {
@@ -160,11 +160,11 @@
]
},
"locked": {
"lastModified": 1789406047,
"narHash": "sha256-HvOg9PZCCvgusyYJvrWKO/8V6Gfpg1/wTd9NREZTbjE=",
"lastModified": 1789410700,
"narHash": "sha256-WE50/Jsa9shfm+uAXi7SF+v7qQ3oc6ZtAOhocoery3Q=",
"owner": "AvengeMedia",
"repo": "DankMaterialShell",
"rev": "6af2b1fbc3eea4c2c0accee56b9c260ce88f5ea2",
"rev": "05c807b7cd87f29dc8c26f8a33cabcaa07d9c823",
"type": "github"
},
"original": {
@@ -214,11 +214,11 @@
]
},
"locked": {
"lastModified": 1789386765,
"narHash": "sha256-4hyLFBhzQC7+qPMELWc7J/sbdA6ckXZxXU9CYRsGhsc=",
"lastModified": 1789430117,
"narHash": "sha256-t+U1mijItLJ64xZOifpfQ17kpAL73nU7pDI48ScacVc=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "87c391f49a34660de6010f35bb50fb1bf811be9f",
"rev": "cda90fd8838825c689fde9d3f3b4e937937790df",
"type": "github"
},
"original": {
+1
View File
@@ -81,6 +81,7 @@
jdt-language-server
typescript-language-server
lua-language-server
luaPackages.luacheck
taplo
marksman
shellcheck
+10
View File
@@ -9,11 +9,21 @@ find . -type f -name "*.sh" -not -path "./.git/*" -exec shellcheck -s bash {} +
echo "✅ ShellCheck passed!"
echo "🌙 Checking Neovim Lua configuration (luacheck)..."
if command -v luacheck &>/dev/null; then
luacheck home/config/nvim --globals vim
else
nix-shell -p luaPackages.luacheck --run "luacheck home/config/nvim --globals vim"
fi
echo "✅ Lua checks passed!"
echo "🐍 Running Python linters & type analysis (Ruff & Pyright)..."
if command -v ruff &>/dev/null && command -v pyright &>/dev/null; then
ruff check --no-cache .
ruff format --check .
pyright .
else
nix-shell -p ruff pyright --run "ruff check --no-cache . && ruff format --check . && pyright ."
fi
echo "✅ Python checks passed!"
echo "❄️ Verifying NixOS flake & sandbox checks..."