Loading...
Split.io's Python SDK uses `get_treatment` with string return values, and Python codebases love to wrap these in helper functions and decorators. FlagShark's AST analysis follows the call chain to every flag reference.
FlagShark generates a PR that removes the dead branch and keeps only the winning code path
from splitio import get_factory
factory = get_factory("SDK_KEY")
factory.block_until_ready(5)
split_client = factory.client()
def get_search_results(user_id: str, query: str):
treatment = split_client.get_treatment(user_id, "search-algorithm")
if treatment == "semantic":
return semantic_search(query)
elif treatment == "hybrid":
return hybrid_search(query)
return keyword_search(query) # controldef get_search_results(user_id: str, query: str):
return semantic_search(query)FlagShark uses Python AST module for static analysis of SDK imports and calls to find every call to getTreatment(), getTreatments(), track()across your Django, FastAPI, Flask codebase.
Each detected flag key is matched against your Split.io project to check rollout status, last evaluation date, and whether the flag is archived or still active.
For each stale flag, FlagShark creates a pull request that removes the SDK call, eliminates the dead code branch, and preserves the winning path. Every PR includes a before/after diff you can review.
Python developers often store the Split client as a module-level singleton initialized at import time — removing the last flag usage means you also need to remove the factory initialization and SDK dependency from requirements.txt.
Grep misses flags behind abstractions. AST-level scanning catches SDK calls that regex can't.
Every cleanup goes through code review. No surprises, no broken builds.
Only flags at 100% rollout for your configured threshold are suggested for removal.
New stale flags are detected automatically. Your codebase stays clean without manual audits.
getTreatment()getTreatments()track()Plus custom patterns you define in .flagshark.yaml
FlagShark parses the string comparisons after `get_treatment` calls and maps each branch to a treatment value. It checks your Split dashboard to determine which treatment won and removes the other branches.
Yes. FlagShark detects `get_treatment` calls inside `get()`, `post()`, and `dispatch()` methods of Django CBVs, as well as in mixins that are shared across multiple views.
FlagShark identifies `track` calls associated with flag-gated code. It marks them for manual review since event tracking may need to continue for analytics purposes even after the flag is retired.
Connect your repo, see stale flags in minutes, and get cleanup PRs automatically.
Free tier available • No credit card required • 5-minute setup
Detect and remove abandoned Split.io treatments from your TypeScript frontend and Node.js backend.
Identify and safely remove stale Split.io treatments from Go services using AST-based analysis.
Systematically find and remove stale Split.io treatments from Spring Boot and Micronaut applications.
Detect and clean up stale Split.io feature flags in Rails and Sinatra applications.
Step-by-step process for identifying and removing dead LaunchDarkly flags in Django, FastAPI, and Flask applications.
Identify and safely remove stale Unleash toggles from Django, FastAPI, and Flask Python applications.
Find and remove dead PostHog flags from Django and FastAPI Python backends.
Identify and remove stale Flagsmith flags from Django and Flask Python applications.
Find and remove stale ConfigCat flags from Django, FastAPI, and Flask Python applications.