21

I am trying to add SonarCloud badge to my README.

But when I do like this

![https://sonarcloud.io/dashboard?id=com.lapots.breed.judge%3Ajudge-rule-engine](https://sonarcloud.io/api/project_badges/measure?project=com.lapots.breed.judge%3Ajudge-rule-engine&metric=alert_status)

The badge itself looks fine but it does not allow to go to sonarcloud project and instead leads to camo.githubusercontent.com.

Which link should I use to access the SonarCloud project?

Thanks.

Jerry Chong
  • 7,954
  • 4
  • 45
  • 40
lapots
  • 12,553
  • 32
  • 121
  • 242
  • 1
    Possible duplicate of [Add SonarQube coverage via shields.io badge](https://stackoverflow.com/questions/43161401/add-sonarqube-coverage-via-shields-io-badge) – 030 Apr 29 '19 at 13:52

4 Answers4

28

You can use this link to access SonarCloud project directly:

https://sonarcloud.io/dashboard?id=Project_Key_Here

Alternatively, you could access your SonarCloud badge via following steps:

  1. Open your SonarCloud project
  2. Click Get project badges button SonarCloud project
  3. Copy the badge link based on your selection on Metric and Format Badge
Jerry Chong
  • 7,954
  • 4
  • 45
  • 40
20

In new version of sonarcloud.io You will find badges in overview page by clicking in Information button on left bottom enter image description here

FBH
  • 685
  • 7
  • 7
  • 1
    Do you know by chance how to change the filetype of the image? It's rendered as SVG, but the slack UI is not displaying it in the notification, so I'd need a jpg/png/whatever instead – Patrick Cornelissen Apr 05 '22 at 03:28
11

The markdown syntax for an image with link is

[![<image title>](<image url>)](link url)

So, try:

[![Sonarcloud Status](https://sonarcloud.io/api/project_badges/measure?project=com.lapots.breed.judge:judge-rule-engine&metric=alert_status)](https://sonarcloud.io/dashboard?id=com.lapots.breed.judge:judge-rule-engine)
Flopp
  • 1,887
  • 14
  • 24
  • 1
    that way it allows to redirect but it doesn't show the badge. I guess I need to access some `svg` somehow directly in the image url – lapots Mar 02 '18 at 09:30
  • 2
    The above code works perfectly for me. See https://github.com/flopp/scratchpad/blob/master/README.md – Flopp Mar 02 '18 at 09:34
  • 1
    yeah I added accidentally space between `Status] (https` – lapots Mar 02 '18 at 09:35
0

As of today, this option is available at the information tab on the sonarcloud, here is ss for my Open source project MSG

SS:

Vipin
  • 4,851
  • 3
  • 35
  • 65