Code references

2 minute read

The code references page helps you locate where a selected feature flag appears in your codebase. This is especially useful when cleaning up flags that are no longer in use.

What you can do

On the Code references page, you can:

  • View where a flag is referenced in your source code.

  • Filter by repository.

  • Search for a specific file or reference.

  • Select Access full list on GitHub to view all search results directly in GitHub (opens in a new browser tab outside the CloudBees platform).

Access code references

To view code references for a flag:

  1. Select Feature management.

  2. On the Flags page, select a flag to open the Configuration page.

  3. On the Configuration page, select the Code references tab.

On the Code references page you can:

  • View a list of repositories associated with the selected application and flag.

  • Select a specific repository to narrow the search.

  • Select Access full list on GitHub to open a GitHub search tab for the selected flag.

  • Review individual file references, each with a direct link to the GitHub search results.

If no repository is selected, the search runs across all connected repositories.

Example code references display

Flag name: METestFlag
  • Created: 2024/11/14 14:40:11

  • Last updated: 2024/11/14 14:44:10

  • Activity status: Inactive

  • File types searched: .ts, .tsx, .go

  • Repositories: All (default)

  • Branches: main (default)

CloudBees found potential references to METestFlag in the following files:

Repository File name View

cloudbees/nextgen-ui

flags.ts

View on GitHub

cloudbees/nextgen-ui

StaticRoutes.tsx

View on GitHub

cloudbees/nextgen-ui

FeatureManagementFlagTabOutlet.tsx

View on GitHub

cloudbees/flag-service

code_references.go

View on GitHub

How it works

  • The GitHub Search API searches for the selected flag name (flagName) across your organization.

  • Results can be filtered by file scope: .ts, .tsx, and .go files.

  • Each result links to GitHub with a prefilled query for the specific file.

  • CloudBees does not link to specific lines—GitHub handles highlighting within the file.

  • If there are no results, GitHub will display an empty search view.

Additional notes

  • Feature flags with dependencies: If a flag has other flags depending on it, you cannot delete it. These dependencies appear in the Code references tab.

  • Scope: The Code references page displays results based on the selected application.