test spell check

This commit is contained in:
Nathan Anderson 2025-10-01 00:08:26 -06:00
parent 903e6b06f1
commit cf2d874f08
2 changed files with 26 additions and 17 deletions

View File

@ -27,22 +27,29 @@ fi
# Spell check # Spell check
if command -v aspell &> /dev/null; then if command -v aspell &> /dev/null; then
echo "Running spell check..." # Check if aspell can find dictionaries
MISSPELLED=0 if ! aspell dump dicts 2>/dev/null | grep -q "en"; then
for file in $STAGED_MD_FILES; do echo "⚠️ aspell found but no English dictionaries available"
# Extract text, strip markdown syntax, check spelling echo " Make sure ASPELL_CONF is set correctly in your direnv"
ERRORS=$(cat "$file" | aspell list --mode=markdown --personal=./.aspell.personal 2>/dev/null | sort -u) echo " Skipping spell check"
if [ ! -z "$ERRORS" ]; then else
echo "⚠️ Possible misspellings in $file:" echo "Running spell check..."
echo "$ERRORS" | sed 's/^/ /' MISSPELLED=0
MISSPELLED=1 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 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 fi
else else
echo "⚠️ aspell not found, skipping spell check" echo "⚠️ aspell not found, skipping spell check"

View File

@ -23,13 +23,15 @@
]; ];
shellHook = '' shellHook = ''
echo "Hugo development environment loaded" # export ASPELL_CONF="dict-dir ${pkgs.aspellDicts.en}/lib/aspell"
echo "Hugo version: $(hugo version)"
# Auto-install git hooks if not already installed # Auto-install git hooks if not already installed
if [ ! -L .git/hooks/pre-commit ]; then if [ ! -L .git/hooks/pre-commit ]; then
bash scripts/install_hooks.sh bash scripts/install_hooks.sh
fi fi
echo "Hugo development environment loaded" echo "Hugo development environment loaded"
echo "Hugo version: $(hugo version)"
''; '';
}; };
} }