Code references currently supports GitHub repositories only.
It performs a basic text search across .ts, .tsx, and .go files using the GitHub Search API; it does not parse code or detect semantic usage.
Results may include matches inside comments, strings, or unrelated code, and may miss usages in unsupported file types.
|
Code references show where a feature flag is referenced in your source code by searching the repositories linked to your application.
|
Before viewing code references, link components to an application. For setup instructions, refer to Set up code references. |
This page explains how the search works, what it can and cannot detect, and how code references connect to flag cleanup.
What code references are
The Code references tab on a flag displays the files in your connected repositories where that flag name appears. Results are scoped to the application you are viewing: CloudBees Unify searches only the repositories associated with that application’s components, not your entire organization.
This scoping is intentional. Feature flags are evaluated in the context of a specific application, so the relevant code is the code that belongs to that application’s components.
How the search works
CloudBees Unify uses the GitHub Search API to search for the flag name as a plain text string across .ts, .tsx, and .go files in the connected repositories.
Results are returned as file-level links that open the relevant GitHub search view in a new tab.
CloudBees Unify does not link to specific lines within files. GitHub handles result highlighting.
If no repository filter is selected, the search runs across all repositories connected to the application’s components. Selecting a specific repository narrows the results to that repository only.
Limitations to be aware of
Because the search is text-based rather than parsed or semantic, results require interpretation.
A match may appear inside a comment, a string literal, or unrelated code that happens to share the flag name.
Conversely, flag usages in file types not covered by the search (anything other than .ts, .tsx, and .go) will not appear in results.
The current implementation supports GitHub repositories only.
These limitations mean code references provide a strong signal about where a flag is likely referenced, but not a guarantee. Before concluding that a flag is safe to remove, review the results in GitHub to confirm the matches represent actual flag evaluations.
Code references and flag cleanup
Code references are most valuable during flag cleanup. A flag that the health view marks as stale or inactive may still appear in code, particularly if the SDK calls have not yet been removed from the codebase. Checking code references before deleting a flag surfaces these cases and prevents breaking changes.
Note that a flag cannot be deleted if other flags depend on it. Dependencies of this kind also appear on the Code references tab.
For guidance on the full cleanup process, refer to Review and clean up feature flags.