Issue with loc counting

Must-share information (formatted with Markdown):

  • docker sonarqube:8.9.1-developer
  • understanding, where sonarqube detects 8000+ new lines of code
  • checking the sonarqube webinterface, using the loc python script and talking to developer about changes

Hi,
I have a strange issue with a sonarqube instance.
The instance was upgraded from version 8.8.0 to version 8.9.1 (that’s the only change on sonarqube side). I’m not sure that’s part of the issue - the last successful check ran on the old version (last week).
The license page shows we’re using around 92k lines from our 100k limit.
image

Now I get an error analyzing a existing project with only some small changes:

Is there any way to check why sonarqube thinks there are 8k+ new lines?
The scanner provided here squtilities/locbyproject.py at master · alexandre-frigout-sonarsource/squtilities · GitHub also shows 92152 loc.

Thanks for your help.

i also have similar issue with sonarqube 8.9 version

Hi @LordPayder,

Welcome to the Community! :smiley:

There are a few reasons why this might have happened and a couple of ways to check what’s going on. Can I suggest some initial steps:

  • If your scans are being driven by a CI tool like Jenkins or Azure DevOps, you can go back through the SonarQube scan logs for the last successful scan and the scan that failed and look for an entry like this:
INFO: Indexing files...
INFO: 352 files indexed
  • Comparing them will show you if SonarQube is including files that were not in the previous analysis.
  • You can also use a utility like cloc to run a quick count of lines of code in the current version of your project and compare to the count SonarQube has in Project Information (recognising that cloc counts more languages than SonarQube analyses, but you should get an order of magnitude at least)

Regards,

Cameron.