Nordes / HoNoSoFt.BadgeIt.SonarQube

Badge for SonarQube using private API keys (server can be local, private or elsewhere)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

HoNoSoFt.badgeIt.SonarQube

Build status

Badge your SonarQube results within your Confluence page or anywhere else (GitHub, GitLab, etc.).

What does it uses under the hood

  • 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.

Configuration

In your configuration file appsettings.json you will need to add the following section:

  "SonarQube":{
    "ApiKey": "[YOUR API KEY]",
    "BaseUri": "https://[YOUR.SonarQube.BaseUri]/"
  }

How to use

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.

API URI's

  • 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 smells
    • NewCodeSmells: New code smells
    • Coverage: Sum of the code coverage within the project branch
    • DuplicatedLinesDensity: Percentage of duplicated lines within the NCLOC.
    • Bugs: Total quantity of bugs within the project.
    • NewBugs: ...
    • ReliabilityRating: ...
    • NewReliabilityRating: ...
    • NewSecurityRating: ...
    • Ncloc: Number of line of code
    • NclocLanguageDistribution: Number of line of code by languages
    • NewTechnicalDebt: New technical debt
    • NewLinesToCover: ...
    • NewMaintainabilityRating: ...
    • Tests: Number of tests
    • SecurityRating: ...
    • 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)

Docker image

A Docker image is available on HoNoSoFt DockerHub.

Example of output

Build status

License

License MIT

About

Badge for SonarQube using private API keys (server can be local, private or elsewhere)

License:MIT License


Languages

Language:C# 89.5%Language:HTML 4.7%Language:JavaScript 2.8%Language:Dockerfile 2.2%Language:Shell 0.5%Language:CSS 0.4%