Include spell check in your unit tests
I’ve been looking into some of my favorite open source projects and trying to find ways I can help and contribute to a given project. I found that most projects have a lot of typos. I started looking into simple ways of validating spelling in the documentation. I found aspell and hunspell Unix commands that have been around for a while to apply spell check to a file.
The following will export a list of all words not found in the hunspell dictionary and create a file with all of those words.
hunspell -l **.md | sort -u > .dic
This will apply the newly created list as a dictionary.
hunspell -p .dic -l **.md
The idea is that we can create a .dic file in the project folder and validate spelling by approving all of the words in the file.
Thoughts
- This only checks .md not .markdown or .txt
- This doesn’t return a non-zero exit code (which is good for tests)
- Need ability to spell check joined words
- Thoughts about spellchecking actual variables in code and different languages
- I’d want to see a better open source tech-dictionary that everyone can share (eg. symlink isn’t a word)
Originally published at gist.github.com.