SonarLint reporting findings in excluded projects

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)

SonarQube 7.9.1
SonarLint for Visual Studio 4.18.0.15344

  • what are you trying to achieve

I’m trying to exclude some projects (“ClassDiagram”, “PSEXModel.Tests” and “TUV.PSExplorer.Server.Tests”) from being scanned for findings from SonarLint.

  • what have you tried so far to achieve this

Using SonarLint Connected Mode, I enabled the option Exlude from Analysis:

The same projects are also exluded in the General Settings --> Analysis Scope of the project in SonarQube:

However, SonarLint still reports findings in those projects:

Could use some help on what to do since I am kind of at my wit’s end…

Cheers,
Robin

Anything that could help me?

Hi @RobCo. Apologies for the delay in replying.

I’ve been through the SonarLint for VS backlog and created a new ticket to try to collect the various bugs/known issues that cause differences between what SonarLint reports and what is reported on the server.

The main one that is impacting you is probably SLVS-1337 - SLVS should support Scanner for MSBuild properties.

For the test projects, you could try the following workaround: create a ruleset that disables the SLVS rules, and set the CodeAnalysisRuleSet property in the test projects to refer to it.

I’m assuming your Class Diagram project contains product code. You could try the same approach with that, but I’d guess that SLVS will then display a gold bar warning that the project ruleset needs to be updated.

1 Like

Hey @duncanp,

thank you for this workaround, works flawlessly!

Cheers,
Robin

1 Like