Question

I am absolutely baffled by this. I have a script that spell checks stuff that is staged in Git. Here is the command that gets the list of misspelled words:

git diff --cached | grep -e "^+[^+]" | aspell list --mode sgml --lang en --extra-dicts=/home/test/dictionary.test --add-sgml-skip={ulink,literal,screen} | sort | uniq

Number of arguments in --add-sgml-skip is not relevant. The dictionary.test file is generated with:

aspell --lang=en create master /home/test/dictionary.test < /home/test/dict.txt

This all works and is all fine but in a single document, it does not work, no words are found. I have no idea why this happens. Here is some more info:

> git diff --cached | grep -e "^+[^+]" | wc -l
250
> git diff --cached | grep -e "^+[^+]" | aspell list --mode sgml --lang en --extra-dicts=/home/test/dictionary.test | sort | uniq | wc -l
39
> git diff --cached | grep -e "^+[^+]" | aspell list --mode sgml --lang en --extra-dicts=/home/test/dictionary.test --add-sgml-skip={ulink} | sort | uniq | wc -l
39
> git diff --cached | grep -e "^+[^+]" | aspell list --mode sgml --lang en --extra-dicts=/home/test/dictionary.test --add-sgml-skip={ulink,literal} | sort | uniq | wc -l
0

When I run this command in other repos, it works flawlessly. I've been trying to figure this out for a day now and am at loss. I must know why this happens otherwise I won't get another night of sleep :) Help would be much appreciated.

Was it helpful?

Solution

Aspell try it with next line to get possible errors (replace test.html to an existing file).

cat test.html | aspell list f- sgml --lang en --extra-dicts=/home/test/dictionary.test --add-sgml-skip={nospell,literal,screen} | sort | uniq

If that gives no errors try it with.

git diff --cached | grep -e "^+[^+]" | cat test.html | aspell list f- sgml --lang en --extra-dicts=/home/test/dictionary.test --add-sgml-skip={nospell,literal,screen} | sort | uniq
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top