Line of Code of shared source files in Monorepo


Are shared source files Line of Code counted twice when using Sonarcloud Monorepo features?

I couldn’t find that explicitly in docs, there are some indications in some topics, but no clear statement.

For example, supposing a c# solution in one repo with three projects:

  • App1.csproj
  • App2.csproj
  • Shared.csproj

Where App1 and App2 have their own build pipeline and Sonarcloud monorepo projects, both reference Shared project which doesn’t have its own build pipeline.

Are there plans to extend monorepo feature to do not count Shared project source code twice?

I know we could exclude its path from one of the projects analysis, are there any other options?



If the files are included in analysis, then their LOC are counted. You can tell whether they’re included in analysis by checking whether you can find them in the project’s Code tab.