{"id":1966,"library":"codespell","title":"Codespell","description":"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.","status":"active","version":"2.4.2","language":"en","source_language":"en","source_url":"https://github.com/codespell-project/codespell","tags":["linter","code quality","spelling","cli","automation"],"install":[{"cmd":"pip install codespell","lang":"bash","label":"Install stable version"}],"dependencies":[{"reason":"Codespell requires Python 3.9 or above.","package":"python","optional":false},{"reason":"Required for Python versions prior to 3.11 when configuring codespell via a pyproject.toml file.","package":"tomli","optional":true}],"imports":[],"quickstart":{"code":"# Check for misspellings in the current directory (dry run)\ncodespell .\n\n# Check specific files or directories (dry run)\ncodespell my_project/README.md my_project/src/\n\n# Interactively fix misspellings in a directory (recommended for review)\ncodespell -i 3 my_project/\n\n# Automatically write corrections to files (use with caution or after review)\ncodespell -w my_project/","lang":"bash","description":"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)."},"warnings":[{"fix":"Always run `codespell` with `-i` (e.g., `codespell -i 3 .`) when planning to apply fixes, or review the dry run output thoroughly before using `-w`.","message":"Using the `--write-changes` (`-w`) flag without interactive mode (`-i`) can lead to unintended automatic corrections of valid but non-standard spellings or technical jargon. It's highly recommended to use `--interactive` (`-i 2` or `-i 3`) to review suggested changes before applying them.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Ensure that `~/.local/bin` is included in your system's `$PATH` environment variable. You might need to add `export PATH=\"$HOME/.local/bin:$PATH\"` to your shell's configuration file (e.g., `.bashrc`, `.zshrc`).","message":"After installing `codespell` with `pip`, the executable might not be directly available in your system's `$PATH`. This often happens if pip installs packages to a user-specific binary directory like `~/.local/bin`.","severity":"gotcha","affected_versions":"All versions"},{"fix":"If you are using Python < 3.11 and configure `codespell` via `pyproject.toml`, ensure `pip install tomli` is executed. Python 3.11 and later include `tomli` in the standard library.","message":"When `pyproject.toml` is used for configuration, Python versions prior to 3.11 require the `tomli` library to be installed. Without `tomli`, `codespell` will fail to read its configuration.","severity":"breaking","affected_versions":"< 3.11 (with pyproject.toml config)"},{"fix":"Always include a trailing comma after the last suggestion when defining dictionary entries with multiple corrections. Refer to the dictionary format documentation for details.","message":"When defining custom dictionary entries with multiple suggested fixes (e.g., `fiel->feel, field, file, phial,`), a trailing comma is crucial. If omitted, the last suggestion in the list will be discarded.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-09T00:00:00.000Z","next_check":"2026-07-08T00:00:00.000Z"}