Narrowing down the scope of the scanning

Input data:

  • ALM used: Azure DevOps
  • CI system used: Azure DevOps Pipelines
  • Languages of the repository: C#, TypeScript, JavaScript, CSS
  • Steps to reproduce: whenever I start the new build process it fails when it comes to publishing a QualityGate result with the following error: "##[error][SQ] Task failed with status FAILED, Error message: This analysis will make your organization ‘xxx’ to reach the maximum allowed lines limit (having 300751 lines). "

My problem is that this number of lines of code is extremely far from reality. I measured the C# code with the command line tool available in GitHub (cloc) and the real numbers are the following:

Having this report in mind, I know there’s is a lot of ‘noise’ that I don’t even want to scan and we have enough capacity with our existing license. At the same time, how do I configure SonarCloud so we only scan the C# code, omitting everything else?
I have already configured the exclusions in the Source File Exclusions, but it doesn’t help to reduce the scanning scope significantly.

Hey there.

The documentation on Narrowing the Focus should be helpful here. If there’s more to exclude than you want to include, use sonar.inclusions, if it’s the other way around: sonar.exclusions.

Keep in mind that we think one of our strengths is being multi-language – so if there are other languages you are actively developing in (not just using libraries of or storing data in), be careful how you configure this. The settings are pretty flexible.