Excluded by org.sonarsource.dotnet.shared.plugins.GeneratedFileFilter

Hi,

How can I disable the org.sonarsource.dotnet.shared.plugins.GeneratedFileFilter on SonarQube while we started the analyze the .cs file but excluded the .generated.cs files?

Please advise

Hi,

We consider that generated code should not be analyzed, since the developer has no direct way to fix issues (apart to fix the code generator). And often generated code may look unmaintainable.

Can you share your use case? Why would you like to have generated code analyzed?

Hi,

We only use the c# plugin for analyze the .cs files.

Here is the step by step for analyze
1-SonarScanner.MSBuild.exe begin /k:“xxx”
2-MSBuild.exe “X:\XYZ.sln” /t:Rebuild /p:Configuration=Release /p:Platform=“Any CPU”
3-SonarScanner.MSBuild.exe end

After display the analyze result on Sonarqube web UI but not display the .generated.cs files.

Here is the error mesage below as:
xxx.generated.cs’ excluded by org.sonarsource.dotnet.shared.plugins.GeneratedFileFilter

DEBUG: Skipping auto generated file:

Please advise how can I disable this filter.

Best

You can’t. This is not an error. We assume generated files should not be analyzed or it will produce garbage results.

Thanks for information.

Best

Hi,

We released SonarC# 7.15 which now has an option to enable the analysis of generated code. It is available in Project > Administration > General Settings > C#.

Note that we still don’t advise the analysis of generated code as it often creates issues which can’t be fixed by developers. When this option is enabled developers are encouraged to list files they don’t want analyzed via the property: sonar.exclusions

Hi,

Can this configuration also be performed via a command line parameter for “dotnet sonarscanner”?

Tks!