Skip to main content

misspellings

Build status

Spell checker for code

This is a Python library and tool to check for misspelled words in source code. It does this by looking for words from a list of common misspellings. The dictionary it uses to do this is based on the Wikipedia list of common misspellings.

The list has been slightly modified to remove some changes that cause a number of false positives. In particular ok->OK was removed (ok is frequently used in perl tests for instance).

Opinionated version

This includes custom additions that should be considered opinionated, such as cancellation vs. cancelation. This is not recommended for anyone’s use.

Example

To try it out, merely run the following (using an old coreutils source tree as an example):

$ git clone git://git.sv.gnu.org/coreutils -b v8.10 coreutils
$ find coreutils -name '*.c' | misspellings -f -
coreutils/src/cat.c:754: efficency -> "efficiency"
coreutils/src/comm.c:198: funtion -> "function"
coreutils/src/expr.c:21: seperate -> "separate"
coreutils/src/pr.c:1417: accomodate -> "accommodate"
coreutils/src/tac.c:342: unneccessary -> "unnecessary"
coreutils/src/test.c:91: supressed -> "suppressed"

Contributions

Contributions are welcome! Please add unit tests for new features or bug fixes. To run all the unit tests run ./setup.py test. If you have tox installed, just run tox.

You can review coverage of added tests by running coverage run setup.py test and then running coverage report -m.

Note that tests are run on Travis for all supported python versions whenever the tree on github is pushed to.

The packaged version is available via pip or easy_install as misspellings. The project page is on pypi:

The source code is available in the following locations:

Pull requests on any of those platforms or emailed patches are fine.

To do

Some items on the TODO list:

  • Implement option to interactively fix files.

  • Give some thought to supporting multiple languages?

  • Might a “common misspellings” list be different for different English users - might an American make one set of mistakes while a German writing English make another? Source of this data?

  • Fix sed flag. Have it support sed -i optionally, have it output all unambiguous sed commands, have it be more careful on what it replaces. It might also be an idea to have a perl output option.

  • Use generators to allow finding errors as you go. Currently misspellings grabs all files first, then checks them, which can take a while.

  • Lacking tests for misspellings cli.

Credits

Release files for misspellings_hurkman 10.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for misspellings_hurkman 10.3
File Size Uploaded
misspellings_hurkman-10.3.tar.gz 52.6 kB Details

Release files / misspellings_hurkman-10.3.tar.gz

Download URL misspellings_hurkman-10.3.tar.gz
Size 52.6 kB
Tags Source
SHA-256 checksum
How to use checksums
059e448d042ce8759b74a0227e221ae309f6bc46f252d8570cac31b2ce92bb75
BLAKE2b-256 checksum
How to use checksums
c1a2efcf8270cc2c7b45394c838a138f911d05e5ee2a92de96d3ef63423ef489
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

10.3 This release

1 release file

10.2

1 release file

10.1

1 release file

10.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page