Uploaded image for project: 'SonarQube'
  1. SonarQube
  2. SONAR-11641

When a Sensor saves empty coverage for a file, don't fallback on executable lines

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 7.7
    • Component/s: Coverage & Tests, Scanner
    • Labels:
      None
    • Estimate:
      Hours
    • Edition:
      Community
    • Production Notes:
      None

      Description

      If a coverage engine reports there are no lines to cover in a file, then we don't store any measure:
      https://github.com/SonarSource/sonar-enterprise/blob/bf8b731205eab25d23f23384f751bcf38ad5d184/sonar-scanner-engine/src/main/java/org/sonar/scanner/sensor/DefaultSensorStorage.java#L490
      And then, there is a fallback on using executable lines computed by the code analyzer:
      https://github.com/SonarSource/sonar-enterprise/blob/master/sonar-scanner-engine/src/main/java/org/sonar/scanner/source/ZeroCoverageSensor.java#L66
      That may be not what is expected by the user:
      https://github.com/jacoco/jacoco/issues/806

      We should "remember" that coverage was stored, even with no lines to cover, and only fallback on executable lines when the coverage was not saved on a file.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                julien.henry Julien Henry
                Reporter:
                julien.henry Julien Henry
              • Votes:
                2 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Due:
                  Created:
                  Updated:
                  Resolved: