Skip to content

Commit

Permalink
[#2] Setup jacoco plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
raeperd committed Apr 14, 2021
1 parent 10ae538 commit 034c440
Show file tree
Hide file tree
Showing 2 changed files with 77 additions and 0 deletions.
3 changes: 3 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ plugins {
id 'org.springframework.boot' version '2.4.4'
id 'io.spring.dependency-management' version '1.0.11.RELEASE'
id 'java'
id 'jacoco'
id "io.freefair.lombok" version "5.3.3.3"
id "org.ec4j.editorconfig" version "0.0.3"
id "org.sonarqube" version "3.1.1"
Expand All @@ -23,6 +24,8 @@ dependencies {
testImplementation 'org.springframework.boot:spring-boot-starter-test'
}

apply from: 'test.gradle'

test {
useJUnitPlatform()
}
Expand Down
74 changes: 74 additions & 0 deletions test.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
test {
useJUnitPlatform()
finalizedBy 'jacocoTestReport'
}

jacocoTestReport {
reports {
html.enabled true
xml.enabled true
}
finalizedBy 'jacocoTestCoverageVerification'
}

jacocoTestCoverageVerification {
violationRules {
rule {
element = 'PACKAGE'

limit {
counter = 'CLASS'
value = 'COVEREDRATIO'
maximum = 1.00
}

excludes = [
'io.github.raeperd.realworld',
]
}
rule {
element = "CLASS"

limit {
counter = 'METHOD'
value = 'COVEREDRATIO'
minimum = 1.00
}

excludes = [
'io.github.raeperd.realworld.RealWorldApplication'
]
}
rule {
element = "METHOD"

limit {
counter = 'INSTRUCTION'
value = 'COVEREDRATIO'
minimum = 1.00
}

excludes = [
'io.github.raeperd.realworld.RealWorldApplication.main*',
]
}
rule {
element = "CLASS"

limit {
counter = 'LINE'
value = 'TOTALCOUNT'
maximum = 100
}
}
rule {
element = "METHOD"

limit {
counter = 'LINE'
value = 'TOTALCOUNT'
maximum = 10
}
}
}
}

0 comments on commit 034c440

Please sign in to comment.