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
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"

View File

@ -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)"
'';
};
}