From cf2d874f08022dc90bd13107b8e654ccc60bc6a9 Mon Sep 17 00:00:00 2001 From: Nate Anderson Date: Wed, 1 Oct 2025 00:08:26 -0600 Subject: [PATCH] test spell check --- .githooks/pre-commit | 37 ++++++++++++++++++++++--------------- flake.nix | 6 ++++-- 2 files changed, 26 insertions(+), 17 deletions(-) diff --git a/.githooks/pre-commit b/.githooks/pre-commit index 3b913c3..c35105e 100755 --- a/.githooks/pre-commit +++ b/.githooks/pre-commit @@ -27,22 +27,29 @@ fi # Spell check if command -v aspell &> /dev/null; then - echo "Running spell check..." - MISSPELLED=0 - for file in $STAGED_MD_FILES; do - # Extract text, strip markdown syntax, check spelling - ERRORS=$(cat "$file" | aspell list --mode=markdown --personal=./.aspell.personal 2>/dev/null | sort -u) - if [ ! -z "$ERRORS" ]; then - echo "⚠️ Possible misspellings in $file:" - echo "$ERRORS" | sed 's/^/ /' - MISSPELLED=1 + # Check if aspell can find dictionaries + if ! aspell dump dicts 2>/dev/null | grep -q "en"; then + echo "⚠️ aspell found but no English dictionaries available" + echo " Make sure ASPELL_CONF is set correctly in your direnv" + echo " Skipping spell check" + else + echo "Running spell check..." + MISSPELLED=0 + for file in $STAGED_MD_FILES; do + # Extract text, strip markdown syntax, check spelling + ERRORS=$(cat "$file" | aspell list --mode=markdown --personal=./.aspell.personal 2>/dev/null | sort -u) + if [ ! -z "$ERRORS" ]; then + echo "⚠️ Possible misspellings in $file:" + echo "$ERRORS" | sed 's/^/ /' + MISSPELLED=1 + fi + done + if [ $MISSPELLED -eq 1 ]; then + echo "" + echo "Review spelling errors above. Add correct terms to .aspell.personal" + echo "Use 'git commit --no-verify' to skip if needed." + exit 1 fi - done - if [ $MISSPELLED -eq 1 ]; then - echo "" - echo "Review spelling errors above. Add correct terms to .aspell.personal" - echo "Use 'git commit --no-verify' to skip if needed." - exit 1 fi else echo "⚠️ aspell not found, skipping spell check" diff --git a/flake.nix b/flake.nix index 5497b40..b81bc2e 100644 --- a/flake.nix +++ b/flake.nix @@ -23,13 +23,15 @@ ]; shellHook = '' - echo "Hugo development environment loaded" - echo "Hugo version: $(hugo version)" + # export ASPELL_CONF="dict-dir ${pkgs.aspellDicts.en}/lib/aspell" + # Auto-install git hooks if not already installed if [ ! -L .git/hooks/pre-commit ]; then bash scripts/install_hooks.sh fi + echo "Hugo development environment loaded" + echo "Hugo version: $(hugo version)" ''; }; }