Loading...
PostHog's Python SDK is popular in Django and FastAPI backends for combining analytics with feature management. FlagShark scans your Python AST to find every `is_feature_enabled()` call and cross-references it with your PostHog project.
FlagShark generates a PR that removes the dead branch and keeps only the winning code path
import posthog
def generate_report(user_id: str, report_type: str):
if posthog.feature_enabled("enhanced-reports", user_id):
return generate_enhanced_report(user_id, report_type)
return generate_basic_report(user_id, report_type)def generate_report(user_id: str, report_type: str):
return generate_enhanced_report(user_id, report_type)FlagShark uses Python AST module for static analysis of SDK imports and calls to find every call to isFeatureEnabled(), getFeatureFlag(), getAllFlags()across your Django, FastAPI, Flask codebase.
Each detected flag key is matched against your PostHog 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.
PostHog's Python SDK sends flag evaluation events to your analytics pipeline — removing a flag from code without archiving it in PostHog first can cause "flag not found" warnings that clutter your server logs.
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.
isFeatureEnabled()getFeatureFlag()getAllFlags()Plus custom patterns you define in .flagshark.yaml
FlagShark uses the `ast` module to trace `posthog.feature_enabled()`, `posthog.get_feature_flag()`, and related calls. It follows the `posthog` module import and any aliases your codebase uses.
Yes. FlagShark detects PostHog calls inside Celery task functions and classes. It generates cleanup diffs that account for the async nature of task execution.
FlagShark handles group-level feature flags by detecting the `groups` parameter in flag evaluation calls. It correctly identifies both user-level and group-level flag checks.
Connect your repo, see stale flags in minutes, and get cleanup PRs automatically.
Free tier available • No credit card required • 5-minute setup
Step-by-step process for identifying and removing dead LaunchDarkly flags in Django, FastAPI, and Flask applications.
Find and clean up stale Split.io feature flag treatments in Django, FastAPI, and Flask projects.
Identify and safely remove stale Unleash toggles from Django, FastAPI, and Flask Python applications.
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.