Macros
How to add a macro
Edit a Confluence page and open Insert elements, or type / in the editor. Search for SonarQube to see the available macros.
SonarQube Connector Macro
Select a configured SonarQube connection and choose the resources to display. The dashboard macro offers these settings:
-
SonarQube server: this is a dropdown list with the SonarQube servers configured through the plugin settings.
-
Resource Key: this is the key of the SonarQube resource to retrieve the quality metrics. You can get this key from your SonarQube project dashboard or your sonar-project analysis parameters.
-
Note: Enterprise portfolios are also supported. Enter the portfolio name in this field.
-
-
Tags: This is an optional field. You can get the projects through the tags associated with them in SonarQube Server or SonarQube Cloud. These tags can be obtained from your project page in SonarQube Server or SonarQube Cloud or from the analysis properties. You can configure more than one tag by specifying a comma separated list of tags. The results will be aggregated in a single view with all the resources together.
-
Custom metrics: List of custom metric keys to display in the page, you can specify one metric key or a list of metric keys separated by commas. For example: blocker_violations, major_violations, classes. Check with your SonarQube administrator to find out the keys to the available metrics
-
Branch: Name of the branch (visible in the SonarQube UI and only available on single project configuration).
Setting multiple resource keys
In Resource Key, enter a comma-separated list of SonarQube project keys. A long list can increase the page load time.
This is very useful if your team manages several software components and you want to have all of them in your Confluence page.
SonarQube Connector for Confluence will aggregate all the metrics into a single view.
This new view provides:
-
A header section with all the collected metrics and global ratings. This includes the project distribution for each rating (size, reliability, security and maintainability) and the aggregated measures.
-
A project portfolio section with the information for each project, including last analysis date and quality gate.
How do we compute the global ratings?
If you configure multiple projects then you will get a global rating for the main quality metrics: size, reliability, security and maintainability:
-
Size rating: this is the sum of all lines of code of all the projects. The rating is computed the same way as for an individual project.
-
Reliability, Security and Maintainability rating: these ratings are computed by giving values from 1 to 5 to each project depending on the rating (A=1 ... E=5). Then we sum all the values and compute the average number. This number is rounded to the nearest value from 1 to 5. This value will be the global rating for your projects.
SonarQube Connector Badge
You have to complete these parameters:
-
SonarQube server: this is a dropdown list with the SonarQube servers configured through the plugin settings.
-
Resource Key: this is the key of the SonarQube resource to retrieve the quality metrics. You can get this key from your SonarQube project dashboard or your sonar-project analysis parameters. You can setup more than one resource/project key by providing a comma separated list of resource keys. Measures will be aggregated into a unique view of all the projects together.
-
Note: Enterprise portfolios are also supported. Enter the portfolio name in this field.
-
-
Tags: This is an optional field. You can get the projects through the tags associated with them in SonarQube Server or SonarQube Cloud. These tags can be obtained from your project page in SonarQube Server or SonarQube Cloud or from the analysis properties. You can configure more than one tag by specifying a comma separated list of tags. The results will be aggregated in a single view with all the resources together.
-
Metric Key: choose the metric to display in the badge. Check out SonarQube metric definitions to know which metric key you should use for each metric.
-
Common values are: ncloc, coverage, reliability_rating, security_rating, sqale_rating, duplicated_lines_density...
-
-
Branch: Name of the branch (visible in the SonarQube UI and only available on single project configuration).
SonarQube Connector Quality Profile
Use the SonarQube Connector Quality Profile macro to display the active rules for a SonarQube quality profile.
You have to complete these parameters:
-
SonarQube server: This is a dropdown list with the SonarQube servers configured through the plugin settings.
-
Quality profile name: This is the name of the SonarQube Quality profile where you are going to retrieve the information. You can get this name from your SonarQube Quality profile dashboard.
-
Quality profile language : This is an optional field in case there are more than one Quality profiles with the same name, you will need to add the Quality Profile language.
-
Organization name: For SonarQube Cloud, use the organization name shown in the project information.
SonarQube Connector Issue Breakdown
Use the SonarQube Connector Issue Breakdown macro to display issues from the selected projects.
You have to complete these parameters:
-
SonarQube server: this is a dropdown list with the SonarQube servers configured through the plugin settings.
-
Resource Key: This is the key of the SonarQube resource where you are going to retrieve the quality metrics. You can get this key from your SonarQube project dashboard or your sonar-project analysis parameters. You can setup more than one resource/project key by providing a comma separated list of resource keys. Measures will be aggregated into a unique view of all the projects together.
-
Note: Enterprise portfolios are also supported. Enter the portfolio name in this field.
-
-
Tags: This is an optional field. You can get the projects through the tags associated with them in SonarQube Server or SonarQube Cloud. These tags can be obtained from your project page in SonarQube Server or SonarQube Cloud or from the analysis properties. You can configure more than one tag by specifying a comma separated list of tags. The results will be aggregated in a single view with all the resources together.
-
Bugs: Select if you want see top bugs on issue breakdown
-
Vulnerabilities: Select if you want see top vulnerabilities on issue breakdown
-
Code Smells: Select if you want see top code smells on issue breakdown
-
Branch: Name of the branch (visible in the SonarQube UI and only available on single project configuration).
SonarQube Connector ASVS report
Use the SonarQube Connector ASVS macro to display SonarQube findings organised by the OWASP Application Security Verification Standard.
You have to complete these parameters:
-
SonarQube server: this is a dropdown list with the SonarQube servers configured through the plugin settings.
-
Resource Key: This is the key of the SonarQube resource where you are going to retrieve the quality metrics. You can get this key from your SonarQube project dashboard or your sonar-project analysis parameters. You can setup more than one resource/project key by providing a comma separated list of resource keys. Measures will be aggregated into a unique view of all the projects together.
Note: Enterprise portfolios are also supported. Enter the portfolio name in this field. -
Tags: This is an optional field. You can get the projects through the tags associated with them in SonarQube Server or SonarQube Cloud. These tags can be obtained from your project page in SonarQube Server or SonarQube Cloud or from the analysis properties. You can configure more than one tag by specifying a comma separated list of tags. The results will be aggregated in a single view with all the resources together.
-
Branch: Name of the branch (visible in the SonarQube UI and only available on single project configuration).
SonarQube Connector ISO 5055 report
Use the SonarQube Connector ISO 5055 macro to display findings related to code quality and architecture under the ISO 5055 standard.
You have to complete these parameters:
-
SonarQube server: this is a dropdown list with the SonarQube servers configured through the plugin settings.
-
Resource Key: This is the key of the SonarQube resource where you are going to retrieve the quality metrics. You can get this key from your SonarQube project dashboard or your sonar-project analysis parameters. You can setup more than one resource/project key by providing a comma separated list of resource keys. Measures will be aggregated into a unique view of all the projects together.
Note: Enterprise portfolios are also supported. Enter the portfolio name in this field. -
Tags: This is an optional field. You can get the projects through the tags associated with them in SonarQube Server or SonarQube Cloud. These tags can be obtained from your project page in SonarQube Server or SonarQube Cloud or from the analysis properties. You can configure more than one tag by specifying a comma separated list of tags. The results will be aggregated in a single view with all the resources together.
-
Branch: Name of the branch (visible in the SonarQube UI and only available on single project configuration).
SonarQube Connector Top 25 CWE report
Use the SonarQube Connector Top 25 CWE macro to display findings mapped to the CWE Top 25 software weaknesses for the selected reporting year.
You have to complete these parameters:
-
SonarQube server: this is a dropdown list with the SonarQube servers configured through the plugin settings.
-
Resource Key: This is the key of the SonarQube resource where you are going to retrieve the quality metrics. You can get this key from your SonarQube project dashboard or your sonar-project analysis parameters. You can setup more than one resource/project key by providing a comma separated list of resource keys. Measures will be aggregated into a unique view of all the projects together.
Note: Enterprise portfolios are also supported. Enter the portfolio name in this field. -
Tags: This is an optional field. You can get the projects through the tags associated with them in SonarQube Server or SonarQube Cloud. These tags can be obtained from your project page in SonarQube Server or SonarQube Cloud or from the analysis properties. You can configure more than one tag by specifying a comma separated list of tags. The results will be aggregated in a single view with all the resources together.
-
Branch: Name of the branch (visible in the SonarQube UI and only available on single project configuration).
SonarQube Connector OWASP Top 10 report
Use the SonarQube Connector OWASP Top 10 macro to display findings grouped by web application security risk for the selected reporting year.
You have to complete these parameters:
-
SonarQube server: this is a dropdown list with the SonarQube servers configured through the plugin settings.
-
Resource Key: This is the key of the SonarQube resource where you are going to retrieve the quality metrics. You can get this key from your SonarQube project dashboard or your sonar-project analysis parameters. You can setup more than one resource/project key by providing a comma separated list of resource keys. Measures will be aggregated into a unique view of all the projects together.
-
Note: Enterprise portfolios are also supported. Enter the portfolio name in this field.
-
-
Tags: This is an optional field. You can get the projects through the tags associated with them in SonarQube Server or SonarQube Cloud. These tags can be obtained from your project page in SonarQube Server or SonarQube Cloud or from the analysis properties. You can configure more than one tag by specifying a comma separated list of tags. The results will be aggregated in a single view with all the resources together.
-
OWASP Year : select the Owasp Year to retrieve the information.
-
Branch: Name of the branch (visible in the SonarQube UI and only available on single project configuration).