Support targetPercentage and history comparisons

XMLWordPrintable

      Problem

      I would like to configure targetPercentage to enforce a minimum percentage of coverage across a project and utilize historyDir and historyThreshold to ensure that the coverage does not drop.

      The check[1] documentation says that these two configuration options are mutually exclusive.

      This will only be used if there is no targetPercentage parameter set.

      https://docs.atlassian.com/clover-maven-plugin/latest/check-mojo.html#historyDir

      Expected behaviour

      If both targetPercentage and historyThreshold are set, Clover should validate against these two values and fail a build in case at least one condition is not met.

      Workaround

      Run clover:check twice, for instance by using two profiles with different Clover settings:

      <profiles>
        <profile>
          <id>clover-target-percentage</id>
          <build>
            <plugins>
              <plugin>
                <groupId>com.atlassian.maven.plugins</groupId>
                <artifactId>clover-maven-plugin</artifactId>
                <configuration>
                  <targetPercentage>80</targetPercentage>
                </configuration>
              </plugin>
            </plugins>
          </build>
        </profile>
        <profile>
          <id>clover-history-threshold</id>
                 ...
                <historyThreshold>1</historyThreshold>
        </profile>
      </profiles>
      
      mvn clover:check -Pclover-target-percentage
      mvn clover:check -Pclover-history-threshold
      

              Assignee:
              Unassigned
              Reporter:
              Matt Nelson
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: