Skip to content

Releases: OldJii/dead-code-pruner

v1.1.0 - Semantic dead-code pruning

26 Jun 10:05

Choose a tag to compare

Highlights

  • Reworked the tool into a tree-sitter powered pruner package with python3 -m pruner and run_pruner.py entry points.
  • Added a 3-phase iterative pipeline: constant/control-flow simplification, constant-return method inlining, and conservative dead-method cleanup.
  • Expanded language coverage for Java, Kotlin, Go, C, C++, JavaScript, TypeScript, Rust, Swift, and C#.
  • Added project-level semantic analysis: method scanning, reference indexing, class hierarchy checks, and conservative method safety promotion.
  • Improved semantic cascade cleanup so method inlining and dead-method replacement continue into if true/false branch elimination.
  • Added dynamic-entry protection for Swift/iOS selectors and Storyboard/XIB references.
  • Added multi-language and project-level regression suites, including full-pipeline Java/Swift/iOS semantic cases.

Usage

pip install -r requirements.txt
python3 -m pruner /path/to/project --dry-run
python3 -m pruner /path/to/project

Notes

This release is intentionally conservative: annotated/framework-managed methods, dynamic references, and potentially external entry points are preserved unless the tool can safely prove the cleanup path.

v1.0.0 - Initial Release

26 May 11:57

Choose a tag to compare

dead-code-pruner v1.0.0

A config-driven static analysis tool that eliminates dead code produced by constant folding in Java/Kotlin projects.

Features

  • Config-driven: Define boolean expressions and their constant values in a YAML/JSON config
  • 6-step pipeline: constant replacement → boolean simplification → compound boolean → if-block elimination → method inlining → dead method cleanup
  • Iterative convergence: Each phase loops until no more changes are found
  • Operator precedence aware: Correctly handles true || A && Btrue (not B)
  • Inheritance-aware: Builds class hierarchy to protect interface implementations, abstract methods, and @Override methods
  • Comment/string safe: All replacements skip comments and string literals
  • Zero dependencies: Pure Python 3.8+, no external packages required (PyYAML optional)

Quick Start

cp pruner.example.yaml pruner.yaml
# Edit pruner.yaml with your constants
python3 prune.py /path/to/your/project