Hello,
I’m a little confused by the definition of (lines of code) and (lines to cover) on sonar documentation .
here is : the lines of code : Number of physical lines that contain at least one character which is neither a whitespace nor a tabulation nor part of a comment.
and lines to cover : Number of lines of code which could be covered by unit tests (for example, blank lines or full comments lines are not considered as lines to cover).
I understand that lines of code = lines to coverWHEN covered lines =0
Can anyone explain more the difference if there is any, please?
Surely these are Lines of Code, but they can’t be covered by unit tests
While some logic like this can (and should) be covered by Unit Tests.
if (answer == null) {
return NO_ANNOTATIONS;
}
The latter sample falls under “lines to cover” (well, the first two lines, not the closing bracket ), the former does not, but they are all “lines of code”