If <SonarQubeExclude>true</SonarQubeExclude> is added to a file in a project (and/or if the file is excluded with sonar.exclusions), then that will not be uploaded to the server (and won't have SonarAnalyzer issues either), but the FxCop issues are showing up (at module level). We should apply the same filtering everywhere.
Here is the root cause of the issue :
By design FXCop is not able to map back any quality issue to a piece of code located in a source file. Some quality issues are for instance attached to some dll or logical entities.
This is a kind of usual FXcop behavior which conflicts with one SonarQube principle: all issues should be associated to a piece of code.
As this is a usual FXCop behavior, we've implemented a trick: each issue not associated to a source file indexed by SonarQube is automatically associated to the SQ project
But then comes the very bad side effect: issues located in excluded source files (so source files not indexed) are also attached to the SQ project -> Boom !
As the trick relates to FXCop, I think the workaround should also be part of the FXCop plugin and not located outside (for instance in the Scanner for MSBuild). The workaround could be the following one :
Only issues not associated to a source file indexed by SonarQube and not attached to a file with the *.cs or *.vb extension will be associated to the SQ project.
Issue originally reported here: https://stackoverflow.com/questions/38370785
If
<SonarQubeExclude>true</SonarQubeExclude>
is added to a file in a project (and/or if the file is excluded with sonar.exclusions), then that will not be uploaded to the server (and won't have SonarAnalyzer issues either), but the FxCop issues are showing up (at module level). We should apply the same filtering everywhere.Here is the root cause of the issue :
As the trick relates to FXCop, I think the workaround should also be part of the FXCop plugin and not located outside (for instance in the Scanner for MSBuild). The workaround could be the following one :
*.cs
or*.vb
extension will be associated to the SQ project.