Uber’s open source tool Piranha is here to eat your stale code
Code is not usually on a piranha’s menu, but this predatory fish is different: Uber has open sourced Piranha for automatically deleting feature flags that are no longer needed. The corresponding code is deleted as well. Let’s see how that works and when to use Piranha.
The open sourcing of Piranha was announced on the Uber blog. Let’s see what it can do.
Piranha keeps technical debt low
As the blog post explains, Uber uses feature flags in mobile app development for Android and iOS. These feature flags may turn into either a successfully implemented feature or be deemed unsuccessful. In both cases, the feature flag is not relevant anymore and turns into a stale feature flag.
These stale feature flags not only clutter up the code, increasing its complexity, but could also interfere with other flags or cause bugs.
That’s where the tool Piranha comes in: It scans source code and automatically detects and deletes stale feature flags along with their corresponding code. Piranha is currently implemented for Objective-C, Swift, and Java, but open source contributors could also make it available for other programming languages.
Uber recommends using Piranha in applications that use feature flags extensively and implement specific APIs to control their behaviour.