Questions tagged [sonarqube]

SonarQube is the open source platform, to continuously inspect code quality of applications. It allows developers to detect bugs and vulnerabilities as well as to decrease code smells or bad practices, in more than 20 different languages.

SonarQube was formerly known as Sonar.

SonarQube is the open source platform, to continuously inspect code quality of applications.

It allows developers to detect bugs and vulnerabilities as well as to decrease code smells, in more than 20 different languages.

Feature overview

  • Fully supports the Leak concept to make sure that the code quality of an application gets only better and better as code is added or updated over time
  • Available for more than 20 languages (including Java, C#, C/C++, Cobol, PL/SQL, ABAP, Javascript, PHP, Web, XML)
  • Built-in components for an easy integration (Maven, Ant, SVN, Git, JIRA, Mantis, Google Analytics, Redmine, Jenkins)

Resources

Tutorials & Examples

Books

11817 questions
23
votes
6 answers

How to correctly configure the property "sonar.java.binaries"?

We are using SonarQube 5.1.2 using Ant runner 2.2 and Java pluging 3.12 for the analysis. I can succesfully analyse my project. I just keep getting this error: Java bytecode has not been made available to the analyzer. The…
Mark
  • 414
  • 1
  • 3
  • 9
23
votes
4 answers

SonarQube issue "Add at least one assertion to this test case" for unit test with assertions?

I'm having issues with SonarQube raising issues with several of my unit tests, prompting the following issue: Add at least one assertion to this test case. Each test case resembles this format (where a number of assertions are delegated to a…
Michael
  • 7,348
  • 10
  • 49
  • 86
23
votes
1 answer

ERROR - Could not complete symbolic execution: reached limit of 10000 steps

With SonarQube 5.2 when I analyse the same project as I did with SonarQube 5.1.2 I see a lot of such error messages in the log when it analyzes Java sources: ERROR - Could not complete symbolic execution: reached limit of 10000 steps for method…
Ernesto Maserati
  • 243
  • 1
  • 2
  • 6
22
votes
1 answer

What is the difference between coverage_exclusions vs exclusions in sonar?

What is the difference between coverage_exclusions vs exclusions in sonar? example: "sonar": { "exclusions": "gulpfile.js, ...", "coverage_exclusions": "gulpfile.js, ..., server/models/*.js", "quality_gate": "...", "server_id":…
Sohail Si
  • 2,750
  • 2
  • 22
  • 36
22
votes
5 answers

Gitlab integration with SonarQube

I am pretty new to Development community and specifically to DevOps practices , as a part of project we are trying to integrate SonarQube with Gitlab , did some R& D on SonarQube and Git CI ( Continuous Integration ) and look like plugin is released…
Adi
  • 221
  • 1
  • 2
  • 3
22
votes
3 answers

How to fail a maven build, if JUnit coverage falls below certain threshold

I'm getting the Unit test coverage percentage metric from sonar rest api. How can I fail the build if it falls below a defined value?
rathna
  • 1,055
  • 2
  • 11
  • 23
22
votes
3 answers

How to inspect a json response from Ansible URI call

I have a service call that returns system status in json format. I want to use the ansible URI module to make the call and then inspect the response to decide whether the system is up or…
Hafiz
  • 4,921
  • 3
  • 19
  • 28
22
votes
4 answers

SONAR complaining about Make the enclosing method "static" or remove this set

I have the following piece of code in my program and I am running SonarQube 5 for code quality check on it after integrating it with Maven. However, Sonar is asking to Make the enclosing method "static" or remove this set. the method is…
Aawan
  • 453
  • 3
  • 6
  • 15
22
votes
3 answers

Can not execute Findbugs Caused by: This project contains Java source files that are not compiled

I am currently using the sonarqube server 5.6 with scanner 2.6.1 and I keep getting errors during analysis for a java project. It appears to complain about some java files not compiled in the binaries folder (there aren't any at all in the binaries…
NicolasW
  • 1,519
  • 5
  • 22
  • 34
22
votes
3 answers

java.lang.UnsupportedClassVersionError: org/sonar/batch/bootstrapper/EnvironmentInformation : Unsupported major.minor version 52.0

Environment details: SonarQube 5.6 Apache Maven 3.3.9 Java version: 1.7.0_09 I integrated SonarQube plugin with java maven project like in pom.xml
user3492783
  • 221
  • 1
  • 2
  • 3
22
votes
3 answers

SonarQube "Close this ConfigurableApplicationContext" in Spring Boot project

I have blocker issue "Close this "ConfigurableApplicationContext"" in main method public static void main(String[] args) { SpringApplication.run(MyApplication.class, args); } I've tried code from SonarQube example public static void…
kimreik
  • 635
  • 1
  • 7
  • 25
22
votes
2 answers

Duplicated block of Code in Sonar for import statements in Java

In Sonar 4.5.6 (with default settings) I am seeing Duplicated Blocks message as My java code for which I am getting the message is like below:- package com.jabong.orchestratorservice.adapter.order.endpoints; import…
tuk
  • 5,941
  • 14
  • 79
  • 162
22
votes
1 answer

Why use SonarQube plugin for Jenkins rather than simply use maven goal sonar:sonar?

I want to launch SonarQube analysis with Jenkins for a Maven 2 project. I first used the goal sonar:sonar in the build configuration. But I just found the SonarQube plugin for Jenkins. Why use it? Is it a better practice and why?
Pith
  • 3,706
  • 3
  • 31
  • 44
21
votes
4 answers

Sonarqube bad coverage because of lombok @Data

I use jacoco for coverage report. When I look at the jacoco report, coverage seems to be good. But in Sonarqube, the coverage is low because it says that @Dataannotation from lombok is not cover by test. Compiled classes is mark as @Generated but…
Martin Choraine
  • 2,296
  • 3
  • 20
  • 37
21
votes
8 answers

SonarQube: Fail to get bootstrap index from server: Status returned by url [http://hostname:9095/sonar/batch/index] is not valid: [403]

I am trying to execute following maven command from jenkins job, mvn clean install sonar:sonar -Dsonar.host.url=http://hostname:9095/sonar -Dsonar.projectKey=mavensample -Dsonar.login=admin -Dsonar.password=admin -X But it fails with following…
user1878934