Find dead Python code (unused imports, functions, classes, methods, variables, unreachable statements) with confidence scores. Use when the user asks to find, audit or clean up unused or dead code in a Python project.
97%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
Passed
No findings from the security scan
| Kind | Confidence | Meaning |
|---|---|---|
unused_import | 90 | Imported name never loaded in its own module and not listed in that module's __all__. |
unused_function | 60 | Module-level function whose name is referenced nowhere in the scanned set. |
unused_class | 60 | Class (module level or nested) whose name is referenced nowhere. |
unused_method | 60 | Method whose name is referenced nowhere. |
unused_variable | 60 | Module-level assignment target whose name is referenced nowhere. |
unreachable_code | 100 | First statement after return, raise, continue or break in the same statement list; reported once per block. |
Decorated functions and methods are exempt in the bundled scanner. The library function scan_sources(..., include_decorated=True) reports them at confidence 50; the command line and scan do not expose that option.
Name load, any attribute name (x.m references m), the name in from m import name, and any string constant that is a valid identifier (covers getattr(obj, "name") and __all__ entries).__all__.__all__, dunder names, and _ alone.--whitelist fnmatch pattern.test_* functions and Test* classes in files named test_*.py or *_test.py.setUp or tearDown.typing.overload.__future__ imports..venv, .git, __pycache__ are skipped. More than 5000 files exits with code 2.errors list with codes syntax_error, file_too_large, decode_error, too_deep.(module, line, name). Module names are paths relative to the scanned directory, or the file name for a single file.