Executable Lines in Java

Hello,

  1. In screenshot, Why number 1 section is executable line, other private statements are not executable line?

  2. In screenshot, Why number 2 S3Service method all 3 lines are executable lines?

3.Why number 3 has only one line is executable line in the screenshot?
4. Why number 4 is not executable line?

I need answers for this questions.
It will be very helpfull for me.
Kind regards,


Hi,

I guess you’re asking because according to the docs several of those lines shouldn’t be considered executable?

Well… we probably don’t consider them executable. But what your screenshot shows with the green marginal markers is that they are covered. And we got that coverage data from your coverage report.

You see, when you provide a coverage report that includes data on a file, we rely entirely on the report for what is and is not coverable (i.e. executable) and toss our own native executable lines calculation out the window.

Does that make sense?

 
Ann

1 Like

Hi Ann,
Thank you for reply. Yes I am talking about that document docs . I didnt understand why 57 and 59 lines look executable line. Only 58. line can look executable line. I have another examples also;

1. In the sonarqube document 8.9 version(that I used version as well.) , there is writing below first screenshot. But in second screenshot (our java Project) line 31 seems executable line. But normally it should be not executable line according to sonarqube document.


2. there is writing below first screenshot. But in second screenshot (our java Project) line 57 seems executable line. But normally it should be not executable line according to sonarqube document.

m3

3. Why 57-58-59 lines are executable lines? Only 58. line should be executable line?


I need answers for these questions. I still continue check the details. We have developer edition version. These questions are importand us. I try to understand logic.

Thank you so much for your support
Kind regards,

Hi,

Again, we calculated executable lines as a fallback for the files not included in your coverage reports.

Your screenshots indicate that your files are included in your coverage reports. So the executable line coverage for those files is thrown away and not reflected at all in the UI. What you’re seeing is not what we consider to be executable lines.

Does that make sense?

 
Ann

Hi Ann,

I didnt understand what you mean (So the executable line coverage for those files is thrown away and not reflected at all in the UI). So coverage calculation is done these parameters lines to cover, or condition to cover etc… sonarqube includes not executable lines to code coverage calculation. This is wrong. There is a mistake what I mean. How can you fix this problem. We have same issue for another classes as well.

Kind Regards,

Hi Ann again,

By the way I am calculating coverage value according to shown parameter values in UI. It gives correct coverage result. But it is shown executable lines wrong. It shows executable lines as not executeable lines. Or it shows not executable lines as executable lines.

Kind regards,

Hi,

Is coverage reported on the file?

  • Yes - we rely entirely on the coverage report.
  • No - we use our own Executable Lines calculation in the overall Coverage% measures

Your screenshots show files where coverage is reported. How do I know that? From the green lines in the margins. You won’t see green lines on files where no coverage has been reported.

So for the files in your screenshots, we rely entirely on the coverage report. If your coverage report says a line is covered, well… it must be “coverable” because it’s covered. If your coverage report says a line is not covered, then it must be coverable, since your coverage report thinks it should have been covered. If your coverage report ignores a line, then it must not be coverable.

That’s it. If there’s a coverage report and the report includes data on a file, we rely entirely on the coverage report for that file and throw away our own Executable Lines calculation.

 
HTH,
Ann