Skip to content
A tool for refactoring code related to feature flag APIs
Java Swift C++ Objective-C Shell CMake
Branch: master
Clone or download

Latest commit

lazaroclapp Enforce Google Java Format for PiranhaJava (#34)
This patch:

1. Runs GJF on all existing Java files under `java/`
2. Updates the sample app original and expected output under 
3. Sets up the build so that GJF is added as a git pre-commit hook
    whenever `./gradlew` is run under `java/`
4. Adds `verGJF` to the travis build for PiranhaJava, which will 
    fail the build on any non-GJF formatted java files.
Latest commit dd050f8 Apr 20, 2020


Type Name Latest commit message Commit time
Failed to load latest commit information.
java Enforce Google Java Format for PiranhaJava (#34) Apr 20, 2020
objc minor modifications Nov 27, 2019
swift Fix package.swift file Mar 25, 2020
.gitignore Request Swift 5.1 Apr 20, 2020
.travis.yml Enforce Google Java Format for PiranhaJava (#34) Apr 20, 2020 Prepare for release 0.0.3. Mar 25, 2020 First commit of Piranha Jan 7, 2019 Merge branch 'piranha-objc' of ssh:// into pir… Nov 27, 2019
LICENSE First commit of Piranha Jan 7, 2019
NOTICE First commit of Piranha Jan 7, 2019 Add Gitter badge Apr 16, 2020
report.pdf ICSE report Feb 21, 2020


Join the chat at

Feature flags are commonly used to enable gradual rollout or experiment with new features. In a few cases, even after the purpose of the flag is accomplished, the code pertaining to the feature flag is not removed. We refer to such flags as stale flags. The presence of code pertaining to stale flags can have the following drawbacks:

  • Unnecessary code clutter increases the overall complexity w.r.t maintenance resulting in reduced developer productivity
  • The flags can interfere with other experimental flags (e.g., due to nesting under a flag that is always false)
  • Presence of unused code in the source as well as the binary
  • Stale flags can also cause bugs

Piranha is a tool to automatically refactor code related to stale flags. At a higher level, the input to the tool is the name of the flag and the expected behavior, after specifying a list of APIs related to flags in a properties file. Piranha will use these inputs to automatically refactor the code according to the expected behavior.

This repository contains three independent versions of Piranha, one for each of the three supported languages: Objective-C, Swift, and Java.

To use/build each version, look under the corresponding [lang]/ directory and follow instructions in the corresponding [lang]/ file. Make sure to cd into that directory to build any related code following the instructions in the README.

A few additional links on Piranha:

  • A technical report detailing our experiences with using Piranha at Uber.
  • A blogpost presenting more information on Piranha.
  • 6 minute video overview of Piranha.


Please feel free to open a GitHub issue if you have any questions on how to use Piranha.


We'd love for you to contribute to Piranha! Please note that once you create a pull request, you will be asked to sign our Uber Contributor License Agreement.


Piranha is licensed under the Apache 2.0 license. See the LICENSE file for more information.

You can’t perform that action at this time.