How to present external data in Sonarqube? - sonarqube

I like to include Gauge (http://gauge.org) results in SonarQube (LTS 6.7.1), basically by simply include execution information for a project (which is stored locally in a junit xml file).
What spec and scenarios have been run etc.
But I completely fail on how to integrate this in sonarqube. I managed to add a new page to sonarqube, but how can I retrieve the values to display ?
So my thought was to have a Sensor reading the Gauge report file and publishing the information. But all the sensorContext.newXXX methods seem wrong to use for this.
Any advise on how to extract and present external information in SonarQube ? Any best practices available ?
Thanks

Related

Rest api to get sonarqube info from bamboo build or vice versa

Is there any way I can get any sonarqube api which can provide the build number of bamboo or any bamboo api which can give sonarqube info.This would really help.
I have so far tried both side but i am surprised both the system are quite clueless about each other. Why it is not possible that a build which ran sonarqube as as one of it's job doesn't have any information about that. Also neither in sonar it tell which build has actually triggered that sonar execution
(Not sure I understand what exactly you are looking for, perhaps this ...? )
I don't believe you can relate a specific Activity (SonarQube analysis) to a specific build (Bamboo), just project to job.
You must have SonarQube Server configured in Bamboo
When executing your job, you can add these sonar.links optional parameters to the analysis step:
sonar.links.homepage Project home page.
sonar.links.ci Continuous integration.
and
sonar.links.scm Project source repository.
sonar.links.issue Issue tracker.
Maybe also specify sonar.host.url=$SONAR_HOST_URL (where SONAR_HOST_URL is the global setting in Bamboo) in the analysis step parameters.
Those populate the Project Overview page sidebar:
That should provide the links from SonarQube back to the other systems of interest.
If you have properly configured Bamboo, you should see a link in Bamboo to the SonarQube project, post execution.

SonarQube Web-API - api/resources not returning all projects

I use the following url to extract a number of metrics for each of the projects we have in SonarQube:
/api/resources?metrics=lines,ncloc,reliability_rating, ...
But, it is missing data for (at least) one of the projects. But if I use the following:
/api/resources?resource=69644
It will pull the data for the project. What would cause the project to not show up in the first use case?
We are currently on SonarQube 5.6.
I'm going to answer my own question...
Turns out this particular endpoint has a hard coded limit of 500 components. Which is a known issue and will not be fixed and the endpoint has been deprecated.
To get the same functionality I've switched to using api/projects/index to get the list of projects and then use api/measures/component for each project I'm interested in getting metrics for.

Is it possible to provide sonar-project.properties to sonarlint-cli?

My objective is to run sonar scan and provide early feed back on defects without uploading scan result to sonar server.
I am planning to use sonarlint-cli to scan code as soon as Git merge request is crated. This will help me to report issues early without running full sonar scan.
I already have multiple module sonar-project.properties at the root folder of source code.
Can I use same sonar-project.properties with sonarlint-cli?
No it's not possible to feed sonarlint-cli with sonar-project.properties. You must use a dedicated sonarlint.json configuration file. See http://www.sonarlint.org/commandline/index.html

Running a Sonar Analysis from the Dashboard

Is there a way to run a Sonar 5.1.1 Analysis completely in the Dashboard GUI?
If not what are the steps to run it otherwise? I can't seem to find a document that walks you through the steps.
The Sonar Server / Dashboard / GUI is just used to display data, not to collect data (this old blog post explains the sonar architecture).
To collect data you can use maven, gradle, ant or sonar-runner for other projects. The documentation that guides you is in ... the sonar documentation :) - see the child pages, as they explain the details of how to configure the technologies I mentioned above.
I suggest you to also have a read at the configuration parameters you can pass, as the docs are not super clear about them.

Retriving project specific information stored in sonar Derby

Please help me out to access the project specific information stored in my Sonar default server derby. As have very leass understading on it.
What I want to retrieve is very simple: it is just the information displayed on every sonar home page (http://localhost:9000/), that is to say the project name, the rules compliance indicator, the code coverage indicator and the build time...
Your guidance will be appreciable..
Thanks in advance..
You should not try to retrieve information directly from the database, for the DB is not an API and may change at any time without notice.
If you want to retrieve information stored by Sonar, please use Sonar Web Service API instead.

Resources