Spell Checking Your Programming from the Linux Command Line

For most of us who didnât do well in high school English class, spell checkers are a real game-changer. Sure, you can still swap a âtoâ and a âtoo,â but a spell checker will catch a lot of typos. But what about in your source code? You usually donât spell check source code and even if you did, the rules are funny. After all, âmy_proejctâ is a perfectly fine variable name, but you probably meant âmy_project.â Thatâs where a program called typos comes in. It aims to be a spell checker for source code that is fast enough and with a low enough false positive rate that you can run it against changed code and reject spelling problems.
Sure, if âmy_proejctâ is a one-time typo, the compiler or interpreter will probably catch it. But it wonât catch comments and it also wonât catch something you spell wrong consistently. For that you need something like typos.
You can include a custom dictionary and also per-language dictionaries. It is aware of camel case and snake case and knows to ignore hex codes. The only thing we saw it doesnât handle well is C-language escapes.
There are apparently other checkers out there and we learned about them from this projectâs comparison grid. Thereâs misspell, codespell, and scspell. This is the tool we didnât know we needed, but probably do.
If you are writing bash scripts and want to check their correctness there is shellcheck, which sounds like spell check but has a whole different function. If you want to brush up on your spelling, you can always hack a Speak ân Spell.
from Blog â Hackaday https://ift.tt/3fwGRUd
Comments
Post a Comment