Skip to main content

A tool to detect misspellings with opinionated additions

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

misspellings_lib-1.0.1.tar.gz (55.1 kB view details)

Uploaded Source

Built Distribution

misspellings_lib-1.0.1-py3-none-any.whl (50.2 kB view details)

Uploaded Python 3

File details

Details for the file misspellings_lib-1.0.1.tar.gz.

File metadata

  • Download URL: misspellings_lib-1.0.1.tar.gz
  • Upload date:
  • Size: 55.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.10

File hashes

Hashes for misspellings_lib-1.0.1.tar.gz
Algorithm Hash digest
SHA256 f896c4d6a34b1e33d2fa43e7b6d7158a5d0aebbd548a8bb710a9319a1ea33df5
MD5 5a89446f77c2aef47b1a615a3ef58be1
BLAKE2b-256 7eb82ad16fce6837070896d1935a21e2d5e029a8d519b0a17023d7be986c6414

See more details on using hashes here.

File details

Details for the file misspellings_lib-1.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for misspellings_lib-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 5135981eba5219cd4f4e16ff45cf30d16ccfd680ffbc1b20834e86d1a96c0f3a
MD5 63d8af85247e92d60bc44db22f84ceb7
BLAKE2b-256 2dfc0cf0367eb522b71f7a022072d4bf58b73f4282b82b5c5a2b37bcbf68d1a6

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page