Sum of metrics over all Sonar projects ? - sonarqube

Is there any way to aggregate metrics over all projects in Sonar ? For instance, is it possible to get the total number of SLOC ?
It seems that it should be a basic feature of Sonar.
I know about the Views plugin, but I'm looking for something free. And I don't need all the features of this plugin, only aggregates over all projects, not custom views.

Since I haven't been able to find anything, I have developed a very simple Sonar plugin that does the trick using the API provided by the Sonar server. Turned out to be pretty simple.
The plugin is available here, but it has been only tested on one Sonar instance.

Related

How to define a metric for the number of lines of code in test package?

I'm working with SonarQube 6.4 and a java project based on maven. We are using SonarQube a lot and I now want to define a metric regarding tests.
Is there a way to know how many lines of code a team has written in the test package?
This is a metric that was considered but was never considered as interesting enough (in regards to other features) to be implemented on the SonarJava plugin. See this ticket for more details : https://jira.sonarsource.com/browse/SONARJAVA-79

Is interaction between a widget plugin and SonarQube server to do analysis possible?

Specifically, I want to run some analysis on the issues generated and rules violated. So I want to design the system to have a few click actions in the web interface of sonar and initiate the analysis in the back-end. The reason for this is that the analyses are run only during some cases and I don't want the instance with my plugin to have additional load during each run.
Also if possible could you point me in the right direction?
I couldn't find anything on here. http://docs.sonarqube.org/display/DEV/Web+API
Please note I have been searching this very recently and am also new to SonarQube.
SonarQube server is for performing analysis only. What I was looking was for the server to give the user access to control the analysis. But using independent plugins to do static analysis could work.
I solved this issue by splitting the plugin into
A plugin for doing inline analysis work (if a need for doing our own static analysis arises)
A WebApp to classify issues, listing them by projects, etc.
This approach seemed more attractive when after discussion, we decided that all functions we wanted out widget to do, our WebApp itself could do. From SonarQube version 6.2, the ruby APIs are going to be deprecated and so moving to a REST-based approach would give an enduring solution.

it is possible to merge two profiles in quality sonarqube

I would like to know if you have a junction between the two profiles of quality, creating a single.
I have a project that uses the JEE technology, and it uses javascript, java and JSF.
Wanted to make a junction of quality profiles (Web + Javascript + Sonar way with Findbugs)
Is there any way to do this?
I'm using sonarqube 4.3 and sonar runner 2.4.
According for your reply
I have to call the sonar runner several times
first for Sonar way in Web perfil
second for Sonar way in JavaScript perfis
third for Sonar way with Findbugs in Java perfis
would give me an example?
You actually don't have to do this and this is not the correct way to solve your problem anyway.
As of SonarQube 4.2 you can use the multilanguage feature and your files will be automatically analyzed by the correct language plugin (detection is based on file extension).
If you are using a version prior to 4.2 you will have to run multiple analysis with the correct language set each time.

Analyzing only modified classes in Sonar

I would like to know if it's possible to focus a sonar analysis in the classes you have modified.
Imagine you have a huge project, analyzed with a SonarQube Ant Task that can spend a lot of time analyzing all its code and generating the results in the server.
If you only modified 3 classes in this huge project... would be possible to make a shorter analysis with only that 3 classes and update the results?
I'm looking the 'sonar.sources' and 'sonar.exclusions' properties, but I cant find a solution.
My idea is to have the complete proyect analyzed in sonar server. If you use the Sonar Eclipse Plugin you can see all the info displayed, and if you use the sonar ant task you can update the information, but only analyzing the source you have modified.
This feature will be implemented in next version of SonarQube (4.0).
You can vote and watch the following ticket: SONAR-3677

Eclipse sonar plugin vs findbugs+pmd+checkstyle eclipe plugins

We are trying to install a CI Platform with (Jenkins,sonar,eclipse ...).
So that every developer can make analysis on his code before commit, I'm wondering between two alternatives :
running local analysis with the sonar plugin.
install the different plugins that sonar use (findbug,pmd,checkstyle ...) and configure them to meet the sonar configuration.
I'm not sure which alternative to use? I used to work with findbugs,pmd, checkstyle in eclipse and they look great.
Can you tell me which is the best alternative?
Thanks in advance.
Regards.
With Sonar plugin you can manage the violations like:
Create a review
Mark a violations as false positive or fixed
View the hot classes and hot violations
View yours reviews
If you use separate plugins you have to go sonar web to do that.
The great advance of sonar is the reviews.
Other question is how many projects you have and will have. I currently work with more than 70 projects and many profiles. Is more simple to me run analysis with one plugin, because I need just add the server and find the project. With other plugin you need add the link for each project in each plugin configuration.
Why not install the Sonar Eclipse plugin?
This was designed to solve the following problems:
Sonar does not support parallel analysis of the same project. This issue rules out the option of each developer running Sonar locally. (See SONAR-2761, SONAR-3306)
You don't really want developers uploading metrics and source code into the Sonar database. They could be working on an uncommitted workspace and would therefore cause both inaccuracies and confusion if Sonar is being used for code review.
Sonar is really designed to be run from a continuous integration server (like Jenkins), building code that has been submitted onto a shared codestream (or branch)
The big advantages of using the Eclipse plugin are:
True local analysis, no updates of the Sonar database
Configuration of the other tools is retrieved from the Sonar server and jars automatically downloaded.
Centralized management of Sonar quality profiles

Resources