Deadcode

Deadcode Logo

Find and Fix Unused Python Code

pre-commit PyPI Python 3.10+ Downloads License: AGPLv3 Coverage CI
Buy Me a Coffee at ko-fi.com

Documentation

Rationale

ruff and flake8 - don’t have rules for unused global code detection, only for local ones F823, F841, F842. deadcode package tries to add new DCXXX checks for detecting variables/functions/classes/files which are not used in a whole code base.

deadcode - is supposed to be used inline with other static code checkers like ruff.

There is an alternative vulture package.

Read the Installation page to install deadcode.

Read the Usage page for usage examples, command line options, the glossary, decorator matching, and exit status.

Read the Rules page for the implemented rules and for ignoring findings with # noqa comments.

Read the FastAPI page for running deadcode on a FastAPI project, including common use cases, dependency injection, and a complete example application.

Read the Pre-commit hook page for setting up and using the pre-commit hook.

Read the Contributing page for the contribution workflow and the feature-request checklist.

Read the Security page for the vulnerability detection process and how to respond to a finding.

Read the Known limitations page for the analyser’s known limitations.

Read the Release notes page for the release history.

Read the Features page for the checked map of README features to source files, tests, and minimum test cases.

Read the Comparison with vulture page for a comparison of deadcode with vulture, starting with the differences that matter most when choosing between them.