Badge your SonarQube results within your Confluence page or anywhere else (GitHub, GitLab, etc.).
- SonarQube server with API Key generated from an account
- Shields.io (Official site, but can be overriden in the config if you prefer to install locally)
- Maybe usage of local nodeJs server might happen in the futur.
In your configuration file appsettings.json
you will need to add the following section:
"SonarQube":{
"ApiKey": "[YOUR API KEY]",
"BaseUri": "https://[YOUR.SonarQube.BaseUri]/"
}
Install in your directory where you want to use it, then execute the command dotnet run
over the web project. However, you must setup the API key and your SonarQube server URL.
- Key: The SonarQube key (i.e.:
Project
) - Branch: (Optional) The SonarQube branch (default will be master, or the one configured within SonarQube)
- Label: (Optional) An overidding label in case we don't like th default label from the metric ;).
- Available metrics
QualityGate
: Quality gate status (ERROR, etc.)QualityGateDetails
: ...Vulnerabilities
: Quantity of vulnerabilities.NewVulnerabilities
: ...SqaleIndex
: ...SqaleRating
: ...CodeSmells
: Total quantity of code smellsNewCodeSmells
: New code smellsCoverage
: Sum of the code coverage within the project branchDuplicatedLinesDensity
: Percentage of duplicated lines within the NCLOC.Bugs
: Total quantity of bugs within the project.NewBugs
: ...ReliabilityRating
: ...NewReliabilityRating
: ...NewSecurityRating
: ...Ncloc
: Number of line of codeNclocLanguageDistribution
: Number of line of code by languagesNewTechnicalDebt
: New technical debtNewLinesToCover
: ...NewMaintainabilityRating
: ...Tests
: Number of testsSecurityRating
: ...AlertStatus
: ...DuplicatedBlocks
: ...
API | Description |
---|---|
/api/badges/key={key} |
By default, return the Quality Gate Status |
/api/badges/key={key} &metric={metric} |
Return the badge based on the requested metric |
/api/badges/key={key} &branch={branchName} &metric={metric} |
Same as previous but provide the specific branch |
/api/badges/key={key} &branch={branchName} &label={overridingLabel} &metric={metric} |
Same as previous, but override the label. |
(The api Example can be seen from the default page)
A Docker image is available on HoNoSoFt DockerHub.