Markus Hastreiter
Markus Hastreiter

Reputation: 138

Ignore Issues on Multiple Criteria not working

I'd like to disable the C# rule "Remove this cast and edit the interface to add the missing functionality" (csharpsquid:S3215). Not in general, but for all files in folders "something\Business\Genome\*.cs") ("something" can be one or more directories)

I'm trying to use the option "Ignore Issues on Multiple Criteria" on this SonarQube project, but I can't figure out the correct setting (or maybe this feature is simply not working?).

Combinations I've tried so far:

Rule Key Pattern               File Path Pattern 
csharpsquid:S3215              **/Business/Genome/*.cs
csharpsquid:S3215              **\Business\Genome\*.cs
csharpsquid:S3215              **//Business//Genome//*.cs
*:S3215                        **/Business/Genome/*.cs
*:S3215                        **\Business\Genome\*.cs
*:S3215                        **//Business//Genome//*.cs

I don't even know if it's the rule key pattern or the file path pattern that is not matching... :-/

Update 08.03.16: Last night I ran some additional tests. Instead of project level I configured this on global level and I used

Rule Key Pattern               File Path Pattern 
csharpsquid:S3215              **/?usiness/?enome/*.cs

to exclude casing issues: no success either.

Then I used just

Rule Key Pattern               File Path Pattern 
csharpsquid:S3215              **/*.cs

to see if it works at all, and it did. So somehow my path must be wrong, but I don't see how.

Update 08.03.16 (2): Here's one line from the log of the build server:

08:57:50.854 INFO  - 0/658 files analyzed, starting to analyze: C:\Program Files (x86)\Jenkins\workspace\Tools .Net (Nightly)\Tools\Business\Genome\Absence.cs

I'm pretty certain it's not a casing issue. But I have another suspicion. I scan a whole solution and apparently SonarQube treats every project in that solution as a component and scans each component/project individually. Is it possible that for the scan paths are relative to the project? Because I see also this in the log:

08:57:43.701 INFO  - Loading plugin stylecopanalyzers
08:57:43.924 INFO  - Base dir: C:\Program Files (x86)\Jenkins\workspace\Tools .Net (Nightly)\Tools\Business\Genome
08:57:43.924 INFO  - Working dir: C:\Program Files (x86)\Jenkins\workspace\Tools .Net (Nightly)\.sonarqube\out\.sonar...
08:57:44.103 INFO  - Source paths: Absence.cs, ...

Upvotes: 2

Views: 1839

Answers (1)

File inclusions/exclusions are based on path relative to each SonarQube module (i.e. Visual Studio project). So if "Business" is a VS project, this indeed won't work.

Upvotes: 2

Related Questions