Home

Awesome

Awesome Codemods

A curated list of tools that don't just point out what needs to be done (like static code analyzers or linters) but actually modify your code. This means they can e.g. be used in pre-commit scripts or with tools like silver-platter.

Code formatters are intentionally excluded here but can be found in https://github.com/rishirdua/awesome-code-formatters.

By Environment

General Python C/C++ Go Debian

General

  1. codespell - check code for common misspellings

Python

  1. yesqa - Remove unnecessary #noqa comments
  2. pyupgrade - upgrade syntax for newer versions of the language
  3. reorder_python_imports - automatically reorder imports
  4. teyit - use recommended style for assert statements
  5. blacken-docs - run black on code fragements in documentation
  6. setup-py-upgrade - upgrade setup.py to new metadata syntax
  7. modernize - modernize Python code for eventual Python 3 migration
  8. autoflake - remove unused imports and unused variables
  9. ruff - ultra-fast linter that can also fix (some of the) issues it reports

C/C++

  1. uncrustify - Code formatting along flexible rules

Go

  1. golangci-lint - linter that can also fix (some of the) issues it reports

Rust

  1. clippy - linter that can also fix (some of the) issues it reports

Debian

  1. lintian-brush - Fix issues reported by lintian
  2. deb-scrub-obsolete - Remove obsolete maintainer script / control file entries
  3. apply-multiarch-hints - Apply multi-arch fixes from https://multiarch.debian.net/
  4. deb-new-upstream - Import new upstream releases or snapshots
  5. cme - Fix various common issues in Debian packages
  6. drop-mia-uploaders - Remove Missing-In-Action uploaders from Maintainer/Uploader fields

Libraries/Tools for refactoring

  1. Bowler - modern Python (deprecated, recommends libcst)
  2. libcst - Python
  3. rerast - transform Rust code using rules
  4. refex - refactor expressions in Python
  5. clang-libastmatcher - CLang AST Matchers
  6. asttokens - token-preserving AST library for Python
  7. pasta - code rewriting for Python using AST mutation instead of string templates

Tools for invoking codemods

  1. pre-commit - Run formatters during git pre-commit
  2. silver-platter - Run codemods against remote repositories and publish changes (creating PRs/pushing)
  3. all-repos - Run codemods across a set of local repositories

Fix aggregators

  1. routine-update - run various codemods for Debian packages
  2. nitpick - Apply the same pre-defined settings across all your projects

Commercial Platforms

  1. CodeFix

Meta

See also the list of awesome code formatters.

License

This awesome list is licensed under the CC-0 license.