Files
kiskaadee 4dc97abef9 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.
2026-09-14 19:33:30 -05:00

33 lines
1.1 KiB
Bash
Executable File

#!/usr/bin/env bash
# scripts/test - Automated test & invariant verification runner for Workstation Config
set -euo pipefail
cd "$(dirname "$0")/.."
echo "🐚 Running ShellCheck across shell scripts..."
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..."
nix flake check -L
echo "✨ All checks and static analyses passed successfully!"