Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does one mark issues as false positives in SonarLint?

I'm experimenting with SonarLint for IntelliJ, but I'm a bit wary of it. It doesn't seem to be offering anything more than IntelliJ already does, and there's no way to even look at what rules it is offering, let alone change them.

Now, maybe it does add something, but, right now, I'm being spammed by false positives. Things like saying a variable is nullable when it was asserted not null in the very previous line. Is there any way to silence the false positives so I can concentrate on what's left?

like image 216
Daniel C. Sobral Avatar asked Mar 16 '16 19:03

Daniel C. Sobral


1 Answers

Standalone Mode

Out of the box, in the stadanlone mode, SonarLint uses a set of default rules. You can find the list of rules in the SonarLint webpage.

Update: You can now configure the rules in the settings.

Connected Mode

It is possible to bind projects to a SonarQube server, and use its Quality Profiles, allowing to customize the rules being used and share the rule set within a team.

On top of that, any known issue in SonarQube that is marked as false positive or won't fix will not be displayed in SonarLint.

Finally, even though we don't promote this feature, you can always add a //NOSONAR as a comment to hide issues.

Changing Highlighting

By default, issues created by SonarLint are highlighted as warnings in IntelliJ, but it can be changed in the following location: Settings > Editor > Colors & Fonts > SonarLint.
It can be useful to make it more clear what SonarLint is contributing with.

Giving Feedback

It would be great if you could show concrete examples of false positives. The rules are constantly being improved, as you can see in this tracker, and feedback is always appreciated. You can open a topic here about false positives.

like image 128
Duarte Meneses Avatar answered Sep 28 '22 07:09

Duarte Meneses