$ show jendrikseipp/vulture
Vulture is a fast static analysis tool for finding unused code in Python programs. It uses the AST module to scan Python files, recording definitions and usages of functions, classes, variables, imports, and attributes, then reports those that are defined but never used. It also detects unreachable code after return, break, continue, raise, and unsatisfiable if/while conditions. The tool is implemented as a library (Vulture class) and a CLI entry point. It supports configuration via pyproject.toml, whitelists to suppress false positives, and noqa comment support. The architecture is modular with separate modules for reachability analysis, noqa parsing, line number utilities, and configuration handling. The codebase is well-tested, with near 100% coverage, and is actively maintained.
The LLM identified 2 files worth highlighting for reuse:
Implements analysis of control flow constructs (if, while, try, return, break, continue, raise) to detect unreachable code. Encapsulated in a separate class with a clean reset() method. Uses a set of 'no-fall-through' nodes and a visitor pattern. Could be extracted for use in other Python static analysis tools or linters that need to determine reachability.
Parses '# noqa' comments to suppress false positive reports. Provides functions to parse noqa lines and check if a given line should be ignored. Supports flake8-compatible error codes (F401, F841) as well as Vulture-specific codes. Modular and reusable for any tool that needs to respect noqa annotations.