Codespell

2.4.2 · active · verified Thu Apr 09

Codespell is a Python command-line tool designed to find and fix common misspellings in text files, primarily within source code. It operates using a curated dictionary of common typos and their corrections, aiming to reduce false positives that typical spell checkers might produce with technical terms or variable names. The library is actively maintained and frequently integrated into CI/CD pipelines and pre-commit hooks for automated code quality checks.

Warnings

Install

Quickstart

To get started, run `codespell` from your terminal in the directory you wish to check. By default, it performs a dry run, listing potential misspellings. Use the `-i` flag for interactive mode to review and confirm changes, or `-w` to automatically apply corrections (use with caution).

# Check for misspellings in the current directory (dry run)
codespell .

# Check specific files or directories (dry run)
codespell my_project/README.md my_project/src/

# Interactively fix misspellings in a directory (recommended for review)
codespell -i 3 my_project/

# Automatically write corrections to files (use with caution or after review)
codespell -w my_project/

view raw JSON →