SonarCloud doesn't analize all the lines of code files

Template for a good new topic, formatted with Markdown:

  • ALM used: Bitbucket
  • CI system used: Jenkins
  • Languages of the repository: html, sql, json
  • Error observed:
    We have the following problem.
    When analizing code from a short-lived branch, all lines of code in the index.html file are analized. But when analize the same code, without changes, in a long-lived branch, not all lines of code in this file are analized. For example, when reviewing the Code tab for the long-lived branch, Lines of Code indicates 620 lines for the file, which is a total of 717 lines that the file contains.
    I am using a paid SonarCloud license.
1 Like

Hi,

Welcome to the community!

Can you provide logs for the two analyses, sensitive values redacted?

The analysis / scanner log is what’s output from the analysis command. Hopefully, the log you provide - redacted as necessary - will include that command as well.

This guide will help you find them.

 
Ann

log_files.zip (11.7 KB)
Hi
I have attached the log files of the analysis of the two short-lived branches (feature, release) and the two long-lived ones (develop and master).

Thank you.

Hi,

Thanks for the logs. The only thing that stands out to me in them is this, which appears in all 4:

WARN: SCM provider autodetection failed. Please use "sonar.scm.provider" to define SCM of your project, or disable the SCM Sensor in the project settings.

While I don’t think it’s relevant in this context, you probably still want to get it handled (in another thread, if you need help).

Can you characterize the missing lines? Are they from particular types of files?

 
Ann

Hi G Ann, thanks for your help.

The difference in the quantity of lines is in the code tab, for .js, .html, and .json files.
For .js and .html files, fewer lines are displayed in long-lived branches. For .json files in long-lived branches it doesn’t show any number of lines.
When clicking the file name to view the detail, it contains all the lines of the file, even though the code tab shows fewer or any lines.

Hi,

I thought for a second this might have to do with server-side analysis caching, but a re-check of your logs showed that all 4 runs came up 404 on a cache download.

I’ve flagged this for more expert attention.

 
Ann

Hi @Hazael_Dorantes_Libe ,

From the logs, I cannot identify any difference in execution. The only difference I see is the configuration of the branches (long or short-lived)
I also see what @ganncamp highlighted, as in the past, we experienced issues with caching; however, that meant that your project was not utilising cache at all, which is completely fine and does not lead to this behaviour.
We are looking into it. I will get back to you in the upcoming days.
Thanks for your patience,
Csaba

1 Like

Hi @Hazael_Dorantes_Libe,

We had to look at the project and try to see the problem described, as we could not find anything on the backend side. The difference you see comes from the difference in what lines are used for.
index.html has 717 lines, but 620 is the actual line of code, which gets analyzed. This is the line number which counts in the paid plan.

Thanks
Csaba

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