Scalability and Large-Scale Systems Engineering
Automating dead code cleanup

Automating dead code cleanup

10/24/2023 · Will Shackleton, Andy Pincombe, Katriel Cohn-Gordon

What this post added

Introduced the Systematic Code and Asset Removal Framework (SCARF) with a subsystem for identifying and removing dead code. SCARF combines static and dynamic analysis (leveraging Glean for code dependency graphs and operational logs for API usage) across multiple programming languages (Java, Objective-C, JavaScript, Hack, Python). It operates at a symbol level for granular analysis and automatically generates code change requests via CodemodService. The system has evolved to analyze the complete augmented dependency graph, leading to a significant increase in dead code removal. It also incorporates application-specific semantics and domain-specific logging to fine-tune dependency analysis. SCARF has automatically deleted over 100 million lines of code.

Read the original post ↗