I'm often struggling with typos when writing code.
Some typos are really nasty to find, such as:
- maintanance => maintenance
- begining => beginning
- proccess => process
of course, they are obvious when you read them here, but in a large repository...
There are three tools I use.
all of them are opensource projects.
All these tools are reporting errors, the first two ones can help you to fix them.
typos
simply type typos
to see the error the tool report.
You can then use typos -w
to fix the ones, the tool suggests.
- Fast
- blacklist dictionaries based
- pre-commit.com hook available
codespell
- blacklist dictionaries based
- interactive mode
- pre-commit.com hook available
cspell
- slow compared to the others
- whitelist dictionaries based
- reports anything it doesn't know, it can be very verbose
- you can easily add your own dictionaries
- ability to dump unknown words with
--words-only
, so you can build your own dictionaries easily - VS Code extension available
- pre-commit.com hook available
Battle fight
-
typos
andcodespell
are definitely easy to use on daily basis -
cspell
is the one I use in VS Code and commit hook, it requires some fine-tuning by building dictionaries, but it's worth it on long term.
Top comments (1)
This post needs to be updated to include
github.com/errata-ai/vale
I'm using it daily with language tool in my IDE