Typos and misspellings in code can be difficult.
Finding them and keeping them out takes vigilance. Lots of mental energy wasted.
The misspellings tool written in Python can be installed using pip install misspellings.
This tool looks for commonly misspelled words in source code. It has a built-in list of common spelling mistakes.
Example: List all Ruby files and pass each of them to the misspellings tool, with the
-f option (file list) set to
- for standard input.
$ find . -name '*.rb' | misspellings -f - ./lib/celluloid/exceptions.rb:12: occured -> "occurred" ./spec/celluloid/calls_spec.rb:12: wasnt -> "wasn't" ./spec/shared/actor_examples.rb:950: slighly -> "slightly" ./spec/support/configure_rspec.rb:44: occured -> "occurred"
(As a courtesy, I edited those misspellings in the Celluloid project. It wouldn’t do to let it be made an example of and then not fixing it.)