Uhla
Uhla

Reputation: 368

SonarLint is not showing all records compared to referenced SonarQube server

We are using SonarQube server version 5.3 with SonarLint 2.0 in connected mode. As an IDE we use Eclipse Mars 2.0 and when we compare results found by SonarQube server with results found by SonarLint within IDE, the results differ (example file 274 errors in IDE, 826 issues in SonarQube!).

One of the usual differentiations is that "Variable could be declared final".

Also one of my colleagues who is using SonarLint for IntelliJIdea is having similar issues (Idea version 2016.1.1, SonarLint 2.0.2, example file - same as used for comparison in IDE 293 errors).

I wonder why there are such differentiations against the server and even between IDEs.

Could someone help me out on this? Thanks.

Upvotes: 12

Views: 8414

Answers (3)

Vishal Jaiswal
Vishal Jaiswal

Reputation: 21

If you just click on the Project, It won't work, You need to go into the project and Click on the java files, Once you start clicking on the Java files present in the Project.You would see SonarLint getting activated and showing you all the errors present.It worked for me

Upvotes: -1

Jan S.
Jan S.

Reputation: 156

I'm facing a similar issue, illustrated by this example: SonarLint 2.0.2: 99 issues. SonarQube 5.4 UI: 116 issues. Differences caused by 2 rules which belong to the Checkstyle Plugin.

As you are talking about "Variable could be declared final" I'm assuming the rule behind your missing issues is pmd:LocalVariableCouldBeFinal, which belongs to the PMD Plugin.

Fabrice has commented on this topic in SonarQube Google Group they "won't add support for any external engine": SonarQube Google Group (this is true for PMD, Checkstyle, Findbugs and others...)

So sadly we can only use rules mentioned in SonarLint rules list which are provided by SonarQube out of the box (i.e. their Java Plugin).

Upvotes: 13

First of all, SonarQube runs a full analysis of your project while SonarLint only analyses the files that you open. So I don't really know how your comparison of issue count can make sense (unless you opened all files one by one in Eclipse).

Second, there are some known reasons why SonarLint will show less or more issues than SonarQube:

  • Some rules based on metrics are computed only in SonarQube. For instance:
    • Insufficient (line or branch) coverage
    • Insufficient comment density
    • Duplicated code
  • You might have defined issue exclusions on SonarQube, which are not taken into account yet in SonarLint
    • But this will come soon
  • You might have defined source code exclusions on SonarQube, which are not taken into account yet in SonarLint
    • But this will come soon

Upvotes: 6

Related Questions