Hello everyone! Today, I'd like to introduce a CLI tool I developed that automatically detects unused Unleash flags. By using this tool, you can easily identify outdated feature flags in your project and help clean up your codebase.
Tool Overview
- Repository: stale-flag-detector
- Function: Automatically detects unused Unleash flags
-
Installation: Clone the repository and generate the executable using the
go build
command
Basic Usage
After building the tool, you can display a list of stale flags by running it as follows:
% ./stale-flag-detector
Stale flags:
- unleash-ai-example-stale
- another-stale-flag
Options
This tool has two main options:
-
--exclude-potentially-stale-flags
- Excludes potentially stale flags from the results
- For more details on potentially stale flags, please refer to the Unleash documentation
-
--output-regex
- Outputs the results in regex format
Example of Regex Output
% ./stale-flag-detector --output-regex
(unleash-ai-example-stale|another-stale-flag)
Practical Usage Example
The true value of this tool is realized when combined with other command-line tools. For example, by combining it with the pt
command (The Platinum Searcher), you can easily identify where stale flags are being used in your project:
% pt -e `./stale-flag-detector --output-regex` ../sample-app-for-unleash-checker
../sample-app-for-unleash-checker/app/stale.py
9:if client.is_enabled("unleash-ai-example-stale"):
Using this method provides the following advantages:
- Accurately locate unused flags
- Simplify codebase cleanup
- Contribute to reducing technical debt
Summary
The stale-flag-detector
is a powerful tool for streamlining the maintenance of projects using Unleash. It can help improve feature flag management and keep your codebase clean. Give it a try!
If you have any feedback or suggestions for improvement, please let us know through Issues or Pull Requests on the GitHub repository. We look forward to hearing your opinions!
Top comments (0)