Skip to content

jason-redding/diff-coverage-compliance

Repository files navigation

Diff-Coverage Compliance Plugin

Diff-Coverage Compliance Plugin uses the Diff Coverage Gradle Plugin (com.form.coverage.gradle.DiffCoverageTask) to compute code coverage of only modified code, then generates a compliance report.

Why should I use it?

  • Automatically configures diffCoverage task based on working tree and staged changes.
  • Supports violation rules for ALL JaCoCo report metrics (minInstructions, minBranches, minLines, minComplexity, minMethods, and minClasses).

Configuration

diffCoverageCompliance {
    reportName = project.projectDir.name
    diffBase = project.properties.getOrDefault('diffCoverageCompliance.diffBase', 'main')
    diffOutputPath = Paths.get("${project.buildDir}", 'diffCoverageCompliance', 'patch.diff')
  
    reports {
        baseReportDir = Paths.get('build', 'reports', 'jacoco')
    
        fullCoverageReport = false
    
        csv = false
        xml = false
        html = false
    }
  
    violationRules {
        failOnViolation = false

        minInstructions: 0.75
        minBranches: 0.75
        minLines: 0.75
        minComplexity: 0.75
        minMethods: 0.75
        minClasses: 0.75
    }
}

Properties

By default, a new diffCoverageCompliance task is added in addition to the required diffCoverage task. To change this behavior and instead have the diffCoverage task enhanced by this plugin (effectively replacing it), set project property diffCoverageCompliance.replaceDiffCoverage to true.

diffCoverageCompliance.replaceDiffCoverage = true       // default is false

Execution

./gradlew diffCoverageCompliance

Command-line Options

Note: The diffCoverageCompliance.replaceDiffCoverage property must be set to false in order to use any command-line options. This is because the command-line options apply only to the diffCoverageCompliance task --- not the diffCoverage task.

./gradlew help --task diffCoverageCompliance

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages