Quantcast
Channel: CodeSection,代码区,Python开发技术文章_教程 - CodeSec
Viewing all articles
Browse latest Browse all 9596

Automate finding misspellings in source code

$
0
0

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 eachof 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"

Viewing all articles
Browse latest Browse all 9596

Trending Articles