Using a project badge
You can include dynamic SonarQube Server badges on your web pages to display information about your project such as the current value of specific metrics or the current quality gate status.
Markdown snippets and simple image URLs are provided to generate the badge code. A unique security token is generated for each project badge and is required to make the badge accessible from third-party tools.
Using project badges can expose sensitive information like your security rating and other metrics. You should only use them in trusted environments.
Generating the badge code
To generate the code of your dynamic project badge:
- Retrieve your project.
- In the top right corner, select Project Information.
- In the Badges section:
- Select the information type you want to display: metric value or quality gate status.
- If you selected the metric value information type, select the metric in Customize badge.
- In Code format, select Markdown (markdown snippet) or Image URL only depending on how you want to include your badge.
- Select the Copy button to copy the code of your badge.
Renewing the badge token
If a project badge URL is accessed by someone who should not have access to it, you can renew the project badge's unique token provided you're a project admin. This invalidates any existing project badge URLs, and you'll have to update all locations where the badge is being used.
To renew the badge token:
- Retrieve the project.
- In the top right corner, select Project Information.
- In the Badges section, select Renew token.
Using the AI Code Assurance project badge
The AI Code Assurance project badge is available if your project adheres to recommended Standards for AI-generated code. Follow these instructions before using the AI Code Assurance badge.
There are two steps to enable AI Code Assurance on your project.
- Go to Project settings > AI-generated code and activate the Contains AI-generated code setting. Projects marked in this way will have an AI CODE label in the Projects page.
- Then, apply an AI-qualified quality gate to your project. Projects marked in this way will have an AI Code Assurance label in the project list. For more information, see the Applying a qualified quality gate article on the Standards for AI code page.
If you’ve completed both steps above, a dynamic AI Code Assurance badge will be available to publish the current status of your AI Code Assured projects on your web pages. This badge works like other SonarQube badges and can be used by any team member with project access; see Using a project badge for instructions.
Was this page helpful?