Friday, 22 November 2013

Finding spelling mistakes in source code

There are quite a few useful open source utilities around for finding spelling mistakes in source code.  Most recently I've been using codespell which works well for me.

Codespell is regularly being updated and comes with a dictionary originally derived from Wikipedia. I normally pull the latest updates from the repository before running it against my source code.

Fetching it and using it is relatively simple:
 git clone git://git.profusion.mobi/users/lucas/codespell  
 cd your-project-dir  
 /path-to-codespell/codespell.py  
..and it will find common spelling mistakes in the entire project directory. Easy!

1 comment:

  1. I worked on a project once where everything from classes to binaries was called trasncoder (not transcoder). The potential damage from making minor changes like name changes outweighed the benefit of fixing the spelling.

    ReplyDelete