A tool to detect misspellings with opinionated additions
Project description
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:
code.google: http://code.google.com/p/misspell-check/
Gitorious: https://gitorious.org/uu/misspell-check
Sourceforge: https://sourceforge.net/p/misspell-check
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
Kevin Lyda: Initial shell goo and python version.
Steven Myint: Better python idioms and style. Mixed case support. Travis/tox support.
Maciej Blizinski: Potential use in OpenCSW pushed move to python.
Ville Skyttä: Sped up wordification, editor-friendly reporting.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file misspellings_lib-1.0.3.tar.gz
.
File metadata
- Download URL: misspellings_lib-1.0.3.tar.gz
- Upload date:
- Size: 55.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e2ea12ec450c106b57037ad6a943e39d087a4f722881dce5349f37b55aad0125 |
|
MD5 | c36de31e3d8970c48852d50c987f10a8 |
|
BLAKE2b-256 | dcc0187e402f3020bcefb9115d76646d94e539d01122363406be14511cf28a3e |
File details
Details for the file misspellings_lib-1.0.3-py3-none-any.whl
.
File metadata
- Download URL: misspellings_lib-1.0.3-py3-none-any.whl
- Upload date:
- Size: 50.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 09fd0f5202b5c586cf4ad29220c69322a9c10ea539fe9cfda5b7628942b9dc27 |
|
MD5 | a1f17c6be60cb4a7ab01ec5a86d26ce6 |
|
BLAKE2b-256 | 0352a02341fa79edf228af356b85c9043199cb3f03400af3aad71e00538ded9b |