Any idea why Sonar LOC doesn’t align with actual source files even after configuring sonar.exclusion

Hi everyone,
We’re seeing discrepancies in Lines of Code reported by Sonar across multiple repositories at an enterprise level. The LOC appears higher than expected even with standardized sonar.exclusions applied across repos.

Analysis runs via CI (Azure DevOps). Looking to understand what factors at scale (language detection, generated files, shared configs, SCM history, etc.) can impact Sonar’s LOC calculation across multiple repos.

Hi,

Where are you seeing this higher number? Are you on the license page? Or on an individual project branch?

Because for license purposes, the largest branch (or PR) of each project is going to be counted. If you’ve got branches you haven’t reanalyzed since you configured those exclusions, they’re probably the source of the higher-than-expected LOC usage since they haven’t cleared out the excluded files/directories yet.

 
HTH,
Ann