SonarLint Check errors only in updated code and not whole file

Hi , I am new to SonarLint . I am using SonarLint for Intellij-Idea-ce. I checked out a project using VCS (Github). SonarLint shows all the errors that were already there in the file even though the current code I am adding doesn’t have any errors.

Is there a way to suppress /filter errors so that it shows errors only in the code I added, and not the whole code of the file? I tried “Analyze VCS changed file using SonarLint” option but that seems to be showing errors on the whole file.
Are there any other plugins that work with SonarLint to achieve this functionality ?

IntelliJ - 2019.1 Community edition
SonarLint - v4.0.2.3009
Thanks in advance.

Hi,

SonarLint can only show issues for the whole file. There are no other plugins that could add that functionality.
However, If you have the project on SonarQube/SonarCloud and those known issues are marked as resolved, you can connect SonarLint to it and SonarLint will hide those known issues.

Hi Duarte,
Do you think I can display errors only in the changed code if I use sonar scanner instead of SonarLint ?

It is difficult to resolve the issue as marked because, every time I fetch my code (from Github) they come with a lot of issues and I don’t want mark all of them resolved.
I just want to see the errors only the code I wrote.
Thanks,
Tarunt

Hi Tarunt

In SonarQube you can focus on the new issues. These are issues introduced in the code since a given baseline. The baseline is typically the start of the current version or the first analysis of the project. This is actually the way we encourage our users to work with SonarQube, specially for legacy projects with a lot of existing issues.