Piranha: An Open Source Tool to Automatically Delete Stale Code

Опубликовано: 04 Март 2026
на канале: Uber Engineering
10,454
143

At Uber, we use feature flags to customize our mobile app execution, serving different features to different sets of users. However, after a feature has either been 100 percent rolled out to our users or an experimental feature has been deemed unsuccessful, the feature flag in the code becomes obsolete. These nonfunctional feature flags represent technical debt, making it difficult for developers to work on the codebase.

Seeking to automate this process, we developed Piranha, a tool that scans source code to delete code related to stale feature flags, leading to a cleaner, safer, more  performant, and more maintainable code base. We run Piranha at Uber in an ongoing pipeline for our Android and iOS codebases, and have used it to remove around two thousand stale feature flags and their related code.

We believe Piranha offers great utility for organizations that use feature flags in their app deployments, and so have open sourced it. Currently implemented for Objective-C, Swift, and Java programs, open source contributors may want to apply Piranha to other languages or improve on its ability to perform deep code refactorings.

Learn more: eng.uber.com/piranha

Check out the project for yourself: https://github.com/uber/piranha