0

I have a source file which causes the static code analysis build to fail because of a bug in Microsofts Code Analysis. It was described in another question.

This is why I want to exclude it from analysis in SonarQube. I added the Exclusion in Administration / General Settings / Analysis Scope / Files / Source File Exclusions.

The value I added is

**/Helper/ReportPrintingOrderDriver.cs

Unfortunately that does not stop the build from failing. The file is still analyzed even with the exclusion.

What can I do to exclude this file from analysis?

Community
  • 1
  • 1
tobre
  • 1,347
  • 3
  • 21
  • 53
  • I tend to think that you face the same issue as stackoverflow.com/questions/35840813/ignore-issues-on-multiple-criteria-not-working – Fabrice - SonarSource Team Mar 16 '16 at 07:39
  • That is too unfortunate. That means SonarQube does not work until I implement the workaround. Is there any intention at SonarSource to enable the exclusion of single files? – tobre Mar 18 '16 at 07:52
  • Well, I see that you want to exclude only 1 specific file, so if you specify "**/ReportPrintingOrderDriver.cs", this should work. – Fabrice - SonarSource Team Mar 18 '16 at 10:28
  • I tried that and the build still fails for the same reason. That means the file was still analyzed and the exclusion did not work. – tobre Mar 18 '16 at 15:13
  • Microsoft Code Analysis (FxCop) is performing binary analysis, so it first compiles your assembly, and then runs checks on the binary. If one of FxCop analyzers throw an error, then that's likely to surface to you. File exclusions can only be done after the analysis has produced a report but when you get to this point the analyzer already failed and reported an error (which is probably not tied to a file). Have you tried removing the failing rule (CA1011) from your quality profile? – Tamas Mar 23 '16 at 13:35
  • When I remove CA1011 from the quality profile, the build succeeds. I can have that as a work around. But I hope that bug of Microsoft Code Analysis and the possibility to exclude individual files in SonarQube will be fixed eventually. Thank you Tamas. – tobre Apr 12 '16 at 13:14

0 Answers0