Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 790
Uhla Avatar asked May 11 '16 09:05

Uhla


People also ask

What is difference between SonarQube and SonarLint?

SonarLint catches issues right in your IDE while SonarQube analyzes pull requests and branches. The combination forms a continuous code quality analysis solution that keeps your codebase clean. You'll spend less time reviewing code issues and more time on code logic and solving interesting problems!

Which is better SonarLint or SonarQube?

Difference between SonarLint and SonarQubeSonarLint gives instant feedback as you type your code. Sonarqube give a vision of the quality of your complete project code base. SonarLint concentrates on what you are writing run time while coding. SonarQube analyzes all the source code for all files in frequent interval.

How do you integrate SonarQube with SonarLint?

In Intellij — Go to File >> Plugins >> Type 'SonarLint' >> Install and Restart IDE. (2) we can choose the SonarQube rules. → To integrate SonarQube(server) and SonarLint in our IDE and run SonarQube code inspection rules per class to give results quickly. Add the sonarQube connection binding.

How do I know if SonarLint is working?

Open a file, you will see the issues reported by SonarLint are highlighted(underlined) in your code, and also listed in the 'Problems' panel. You can access all rules in the SONARLINT RULES section on you right.


1 Answers

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).

like image 158
Jan S. Avatar answered Oct 22 '22 20:10

Jan S.