Reducing LoC checked

We have a project where we have a significant amount of generated code checked into git, that we no longer want Sonarcloud to analyse to reduce our total LoC. How do we do this?


Did you try using some of those properties ?

  • sonar.sources
  • sonar.exclusions

You’ll find some interesting info on the doc page “narrowing the focus” and in the “analysis parameters” page as well.


1 Like

I have the following


I also set “resources/js/rules/*” in the UI, but it is still counting these lines which is putting me close to the limit of 100k lines.

If I set the setting in the UI, will it be applied immediately? or only after all branches have been build with this setting?

1 Like

Ah … it now dropped from 72k lines to 28k lines … guess I just needed to be more patient :slight_smile:


The LoC is computed after the background tasks executes. For a given project, the nLoC is the highest number of LoC of any branch (if you have 15k LoC on master and 25k LoC on develop, your project has 25k LoC).

Please note that the following line will exclude any file in the rules/ directory but not files in subdirectories

If you want to exclude the whole directory : sonar.exclusions=resources/js/rules/**/*


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