spellchecker for source code
Project description
kodespel
kodespel is a spellchecker for source code.
It is implemented as a small Python script with
all the real work done in a library (package kodespel).
kodespel's nifty trick is that it knows how to split common programming identifiers like 'getAllStuff' or 'DoThingsNow' or 'num_objects' or 'HTTPResponse' into words, feed those to ispell, and interpret ispell's output.
Requirements & installation
kodespel requires Python 3.6+ and ispell. To install ispell, use your OS-specific package manager (e.g. apt, dnf, brew, ...).
To install kodespel itself, use pip:
pip install --user kodespel
(Or install it in a virtualenv if you prefer.)
Usage
Basic usage is to run kodespel on one or more individual files or directories:
kodespel foo.py main.go README.md
kodespel uses a collection of dictionaries to spellcheck each file.
It always uses the base dictionary,
which is a set of words common in source code
across languages and platforms.
Additionally, there is a language-specific dictionary
for each language the kodespel knows about.
Language-specific dictionaries are automatically chosen for you.
In this example, kodespell will spellcheck each file with:
foo.py: dictionariesbaseandpythonmain.go: dictionariesbaseandgoREADME.md: dictionarybaseonly (no language dictionary for Markdown)
If run on a directory, kodespel will recurse into that directory and spellcheck every file that it recognizes:
kodespel src/
will search for *.py, *.c, *.h, and any other
extension that kodespel has built-in support for.
(Currently: Python, Perl, Go, C, C++, and Java.)
Unsupported files are ignored, but if you pass those filenames
explicitly, they will be checked.
kodespel ships with several other common dictionaries.
For example, if the program you are spellchecking uses
a lot of Unix system calls, you would add the unix dictionary:
kodespel -d unix foo.py main.go README.md
The -d option applies to every file being checked.
To see the list of all builtin dictionaries, run
kodespel --list-dicts
Finally, you can create your own dictionaries, and use as many of them as you like. A dictionary is a plain text file with one word per line:
$ cat myproject.dict
nargs
args
You can specify your person dictionaries with -d,
just like kodespel's builtin dictionaries:
kodespel -d unix -d myproject.dict foo.py ...
See also
A tool with similar goals but a different implementation is codespell.
The main advantage of codespell is that it seems to have many fewer false positives.
The main advantage of kodespel is that it checks identifiers, not just comments and strings, so can find a lot more errors. And more false positives too, unfortunately.
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file kodespel-0.1.1.tar.gz.
File metadata
- Download URL: kodespel-0.1.1.tar.gz
- Upload date:
- Size: 12.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.6.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b1b6383f58579efe574cd5bcee456271d106cf9481e833eca4fead6a6e6afd65
|
|
| MD5 |
ffa3fb616e7631b90db726c45e9b9d57
|
|
| BLAKE2b-256 |
6c5fa0b9ffcfa8e95c356b15edc359561e9bd45dc03cc77321bbed4624a397be
|
File details
Details for the file kodespel-0.1.1-py3-none-any.whl.
File metadata
- Download URL: kodespel-0.1.1-py3-none-any.whl
- Upload date:
- Size: 12.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.6.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e6080b8f70b9a582a07eaa9f2d898c3a653b431461913972814e591bbaa4e165
|
|
| MD5 |
0d1f5551bed2e107a8d4120f3f81d5e6
|
|
| BLAKE2b-256 |
188b7e9734483be63ebc1e8be8a8c9654049a9cdf6bdcb753219e52901e6a38e
|