Reseting the LOCs in sonarqube

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension) 9.7.0-developer
  • how is SonarQube deployed: Helm
  • what are you trying to achieve: I am having mono repository, I have sonarqube configured with mono-repo now my lines of code exceeds the limit and some of the project did not analyzed. Now, my projects lines of code reduced by cleanup but still I am getting issue that lines of code exceeds 250k,
  • I tried to delete one project and reanalyzed it but still getting the same error what shall I do now

Do not share screenshots of logs – share the text itself (bonus points for being well-formatted)!

Hi,

Welcome to the community!

It’s likely that your analysis includes more lines of code than you think. Add -Dsonar.scanner.dumpToFile=[file path] to the analysis command line to get a listing of the properties analysis is running with and review what / how much is included in analysis.

:warning: Also, make sure you upgrade to SonarQube v9.9 LTS soon, not only to benefit from our Best LTS Ever™, but because soon we will systematically ask users to upgrade when they ask questions about earlier versions of SonarQube, which are now considered unsupported. :smiley:

 
Ann

I wanted to know if I clean all the projects and analyzing them again can help me with LOC exceeds issue as we have reduced the no. of lines in our code? I have upgraded the sonarqube 9.9.0-developer as suggested by you and added the parameter also.

Hi,

I’m not sure what you mean by “clean all the projects”. I guess you’re talking about deleting everything and starting over? It’s drastic, but if you’ve indeed reduced your lines of code it would work.

On the other hand it would be just as effective, to simply re-analyze the projects where you’ve reduced the lines of code. That would bring your overall License LOC down just as effectively.

 
HTH,
Ann

1 Like

Hey, G Ann! I’m in a similar boat. We love SonarQube and we use it everyday! But, we’re at the very top end of our loc and we need to do some clean up before scanning starts failing due to the max loc license limit. We’re in the process of upgrading our license count and paying for more loc on the next tier, but in the mean time, we are cleaning up some superfluous code that doesn’t need to be scanned. I’ve been reading the docs but I haven’t found the answer to this question.

Q: Once we’ve added a value to General Settings >> Analysis Scope >> Global Source File Exclusions, what needs to happen to reduce the LOC license count? Do we just need to re-run the build and a scan? For example, we have one project, that has already been scanned by SonarQube, that has 45,678 CSS files. I set the Global Source File Exclusions to: **/*.css What do I need to do to “kick this into gear” and reduce the LOC license count? If I run another build/scan, will that filter out all the CSS files and reduce the LOC license count by 45,678?

BTW - we’re on Enterprise Edition v10.5.1 (90531)

Hi @pythonredteam,

Welcome to the community!

You’ve resurrected a topic that’s nearly 1.5y old. Per the FAQ, please don’t do that.

Normally I would ask you to create a new thread with all the details, but this one is pretty simple: yes; reanalyze.

 
Ann

1 Like