Skip to main content

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: dictionaries base and python
  • main.go: dictionaries base and go
  • README.md: dictionary base only (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.

Metadata

Release files for kodespel 0.1.1

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

Source distribution (sdist)

Source distribution for kodespel 0.1.1
File Size Uploaded
kodespel-0.1.1.tar.gz 12.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for kodespel 0.1.1
File Interpreter ABI Platform
kodespel-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 24.7 kB

Release files / kodespel-0.1.1.tar.gz

Download URL kodespel-0.1.1.tar.gz
Size 12.4 kB
Tags Source
SHA-256 checksum
How to use checksums
b1b6383f58579efe574cd5bcee456271d106cf9481e833eca4fead6a6e6afd65
BLAKE2b-256 checksum
How to use checksums
6c5fa0b9ffcfa8e95c356b15edc359561e9bd45dc03cc77321bbed4624a397be
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / kodespel-0.1.1-py3-none-any.whl

Download URL kodespel-0.1.1-py3-none-any.whl
Size 12.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e6080b8f70b9a582a07eaa9f2d898c3a653b431461913972814e591bbaa4e165
BLAKE2b-256 checksum
How to use checksums
188b7e9734483be63ebc1e8be8a8c9654049a9cdf6bdcb753219e52901e6a38e
Upload date
Uploaded using Trusted Publishing?
What is 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

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1

2 release files

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