Operations 4 min read

How Uber’s Open‑Source Piranha Automates Stale Code Removal

Uber open‑sourced Piranha, an automated tool that scans codebases, generates refactoring diffs, and removes obsolete feature‑flag code, helping teams reduce technical debt, improve performance, and accelerate development cycles across mobile platforms.

Programmer DD
Programmer DD
Programmer DD
How Uber’s Open‑Source Piranha Automates Stale Code Removal

Uber open‑sourced an automation tool called Piranha that can automatically delete obsolete and unused code from application codebases.

The tool was created to eliminate the negative impact of stale feature flags after a feature is fully rolled out or an experiment fails, which otherwise creates technical debt, bloats applications, and hampers performance and new development.

Piranha scans source code, generates appropriate refactorings by analyzing the abstract syntax tree (AST), packages the changes into a diff, and assigns it to the original author for review and integration.

It can run as a standalone refactoring tool or as part of a workflow pipeline that periodically generates diffs and tasks to clean up stale flags, with a reminder bot (PiranhaTidy) to ensure actions are taken.

The pipeline uses a heuristic to treat flags unchanged for a configurable period as stale; Uber reports that Piranha can process millions of lines of code and produce a diff in under three minutes.

So far Piranha has been used in Uber’s Android and iOS codebases, removing about two thousand stale flags and related code. The open‑source release includes three independent versions for Objective‑C, Swift, and Java, with plans to support more languages.

More information is available on Uber’s engineering blog: https://eng.uber.com/piranha/

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

Code Refactoringopen sourcesoftware maintenanceUberautomated cleanupPiranha
Programmer DD
Written by

Programmer DD

A tinkering programmer and author of "Spring Cloud Microservices in Action"

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.