Subfolders with a git repository are missing from analysis

I have a folder with a C# solution in it, with multiple projects in subfolders. Some of the subfolders have their own git repo associated with them, so there’s a .git folder in those subfolders. For some reason, those subfolders seem to be omitted during analysis.

Example folder structure

> .git
> MyProject1
> > .git
> > MyProject1.csproj
> > Program.cs
> MyProject2
> > MyProject2.csproj
> > Program.cs
MyProjects.sln

MyProject1 will be omitted in the analysis. I expect it to be there as well.

I’m using:

  • the Sonarqube 8.3-community docker image
  • dotnet-sonarscanner 4.9.0

thanks @stefanloerwald for opening this topic on the community forum!

Could you please give us the verbose output of the END step (please run SonarScanner.MSBuild.exe begin /k:"MyProject" /d:sonar.verbose=true as the BEGIN step, and please attach the output of END step) ? It will help us narrow down the problem.

After I talked with some colleagues, it seems this is the default behavior of the sonar-scm-git plugin, which is enabled by default. Please read the Docs.

@stefanloerwald to fix your problem you can use the sonar.scm.exclusions.disabled analysis parameter (during the BEGIN step)

See Narrowing the Focus and also Analysis Parameters:

sonar.scm.exclusions.disabled For supported engines, files ignored by the SCM, i.e. files listed in .gitignore , will automatically be ignored by analysis too. Set this property to true to disable that feature.

Hi @Andrei_Epure,

thanks for your reply. I find that default behavior quite strange, as it happens silently and from the report in SonarQube, there’s no indication why. I suggest adding a warning in the UI with the hint towards the setting.

BR
Stefan

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.