Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-54773

Jacoco plugin 3.0.4 ignores minimum****Coverage options

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Critical Critical
    • jacoco-plugin
    • None

      Jacoco plugin ignores minimum***Coverage options and sets it to 0 when maximum***Coverage weren't set.

       

      We call Jacoco this way (pipeline stage step)

      jacoco(execPattern: '**/*.exec', changeBuildStatus: true, exclusionPattern: '**/*Test*.class', inclusionPattern: '**/*.class', minimumMethodCoverage: '10')

       But in log I see this:

      Health thresholds: JacocoHealthReportThresholds [minClass=0, maxClass=0, minMethod=0, maxMethod=0, minLine=0, maxLine=0, minBranch=0, maxBranch=0, minInstruction=0, maxInstruction=0, minComplexity=0, maxComplexity=0]

      On the other side, in case when jacoco calls this way (we've added maximumMethodCoverage option): 

      jacoco(execPattern: '**/*.exec', changeBuildStatus: true, exclusionPattern: '**/*Test*.class', inclusionPattern: '**/*.class', minimumMethodCoverage: '10', maximumMethodCoverage: '80'

      And in log something new:

      Thresholds: JacocoHealthReportThresholds [minClass=0, maxClass=0, minMethod=10, maxMethod=80, minLine=0, maxLine=0, minBranch=0, maxBranch=0, minInstruction=0, maxInstruction=0, minComplexity=0, maxComplexity=0]

       

       

      Probably, issue in the class JacocoHealthReportThresholds (package hudson.plugins.jacoco) in method public void ensureValid(), e.g.:

      1. maxClass was parsed as 0 (not set) and applyRange returns 0 ;
      2. minClass was set to 10 and applyRange is called with params 0, 10, 0 and return 0 .

       

      See: https://github.com/jenkinsci/jacoco-plugin/blob/master/src/main/java/hudson/plugins/jacoco/JacocoHealthReportThresholds.java#L49-L59

          [JENKINS-54773] Jacoco plugin 3.0.4 ignores minimum****Coverage options

          Dmitry Zhukov created issue -
          Dmitry Zhukov made changes -
          Description Original: Jacoco plugin ignores minimum****Coverage options and sets it to 0 when maximum****Coverage weren't set.

           

          We call Jacoco this way (pipeline stage step)
          {code:java}
          jacoco(execPattern: '**/*.exec', changeBuildStatus: true, exclusionPattern: '**/*Test*.class', inclusionPattern: '**/*.class', minimumMethodCoverage: '10'){code}
           But in log I see this:
          Health thresholds: JacocoHealthReportThresholds [minClass=0, maxClass=0, minMethod=0, maxMethod=0, minLine=0, maxLine=0, minBranch=0, maxBranch=0, minInstruction=0, maxInstruction=0, minComplexity=0, maxComplexity=0]
          On the other side, in case when jacoco calls this way (we've added maximumMethodCoverage option): 
          {code:java}
          jacoco(execPattern: '**/*.exec', changeBuildStatus: true, exclusionPattern: '**/*Test*.class', inclusionPattern: '**/*.class', minimumMethodCoverage: '10', maximumMethodCoverage: '80') 

          {code}
          And in log something new:
          {code:java}
          Thresholds: JacocoHealthReportThresholds [minClass=0, maxClass=0, minMethod=10, maxMethod=80, minLine=0, maxLine=0, minBranch=0, maxBranch=0, minInstruction=0, maxInstruction=0, minComplexity=0, maxComplexity=0]{code}
           

           

          Probably, issue in the class JacocoHealthReportThresholds (package hudson.plugins.jacoco) in method public void ensureValid(), e.g.:
           # maxClass was parsed as 0 (not set) and applyRange returns 0 ;
           # minClass was set to 10 and applyRange is called with params 0, 10, 0 and return 0 .

           

          See: https://github.com/jenkinsci/jacoco-plugin/blob/master/src/main/java/hudson/plugins/jacoco/JacocoHealthReportThresholds.java#L49-L59
          New: Jacoco plugin ignores minimum****Coverage options and sets it to 0 when maximum****Coverage weren't set.

           

          We call Jacoco this way (pipeline stage step)
          {code:java}
          jacoco(execPattern: '**/*.exec', changeBuildStatus: true, exclusionPattern: '**/*Test*.class', inclusionPattern: '**/*.class', minimumMethodCoverage: '10'){code}
           But in log I see this:
          {code:java}
          Health thresholds: JacocoHealthReportThresholds [minClass=0, maxClass=0, minMethod=0, maxMethod=0, minLine=0, maxLine=0, minBranch=0, maxBranch=0, minInstruction=0, maxInstruction=0, minComplexity=0, maxComplexity=0]{code}

           On the other side, in case when jacoco calls this way (we've added maximumMethodCoverage option): 
          {code:java}
          jacoco(execPattern: '**/*.exec', changeBuildStatus: true, exclusionPattern: '**/*Test*.class', inclusionPattern: '**/*.class', minimumMethodCoverage: '10', maximumMethodCoverage: '80') 

          {code}
          And in log something new:
          {code:java}
          Thresholds: JacocoHealthReportThresholds [minClass=0, maxClass=0, minMethod=10, maxMethod=80, minLine=0, maxLine=0, minBranch=0, maxBranch=0, minInstruction=0, maxInstruction=0, minComplexity=0, maxComplexity=0]{code}
           

           

          Probably, issue in the class JacocoHealthReportThresholds (package hudson.plugins.jacoco) in method public void ensureValid(), e.g.:
           # maxClass was parsed as 0 (not set) and applyRange returns 0 ;
           # minClass was set to 10 and applyRange is called with params 0, 10, 0 and return 0 .

           

          See: [https://github.com/jenkinsci/jacoco-plugin/blob/master/src/main/java/hudson/plugins/jacoco/JacocoHealthReportThresholds.java#L49-L59]

            ognjenb Ognjen Bubalo
            m_z Dmitry Zhukov
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: