New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Introduce task for JaCoCo plugin for enforcing code coverage metrics #983
Changes from 1 commit
313367a
d7f3b7d
3f50fcd
5c3a8ad
c27a0b2
3f971f7
2c7be9f
530828f
493e282
317ec14
5b0f085
f8f3070
9b5ed0a
358a6f9
a73a193
6627b49
8e6d20c
70b0f0a
aed27f6
00b2cb3
0dc8b31
45674bd
ebb4d11
41dcf72
0521afb
6c63ff9
db94948
f024a94
aa402c8
08882e9
6b1f8d9
1eb517c
8d06c8f
699a622
47feb94
8097fdd
ff77afc
1e31712
a7a4592
d900795
d832d0d
ec1b003
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,7 +20,10 @@ | |
import groovy.lang.DelegatesTo; | ||
import org.gradle.api.Action; | ||
import org.gradle.api.Incubating; | ||
import org.gradle.api.tasks.Input; | ||
import org.gradle.api.tasks.Nested; | ||
|
||
import java.io.Serializable; | ||
import java.util.List; | ||
|
||
import static groovy.lang.Closure.DELEGATE_FIRST; | ||
|
@@ -31,13 +34,14 @@ | |
* @since 4.0 | ||
*/ | ||
@Incubating | ||
public interface JacocoViolationRule { | ||
public interface JacocoViolationRule extends Serializable { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Silly question: why does this need to be |
||
|
||
void setEnabled(boolean enabled); | ||
|
||
/** | ||
* Indicates if the rule should be used when checking generated coverage metrics. | ||
*/ | ||
@Input | ||
boolean isEnabled(); | ||
|
||
void setElement(String element); | ||
|
@@ -47,6 +51,7 @@ public interface JacocoViolationRule { | |
* <a href="http://www.eclemma.org/jacoco/trunk/doc/api/org/jacoco/core/analysis/ICoverageNode.ElementType.html">org.jacoco.core.analysis.ICoverageNode.ElementType</a>. | ||
* Valid scope values are BUNDLE, PACKAGE, CLASS, SOURCEFILE and METHOD. Defaults to BUNDLE. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there any kind of precedence here? e.g., if I define a limit for There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure about that. IMHO that's something the Ant task should handle for us. |
||
*/ | ||
@Input | ||
String getElement(); | ||
|
||
void setIncludes(List<String> includes); | ||
|
@@ -55,6 +60,7 @@ public interface JacocoViolationRule { | |
* List of elements that should be included in check. Names can use wildcards (* and ?). | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this a Ant-like pattern or something different? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It has been taken from the JaCoCo documentation (see "Element |
||
* If left empty, all elements will be included. Defaults to [*]. | ||
*/ | ||
@Input | ||
List<String> getIncludes(); | ||
|
||
void setExcludes(List<String> excludes); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We need javadoc on the setters. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Seems to be a pattern we use across various plugins e.g.
That's why I didn't add it. |
||
|
@@ -63,11 +69,13 @@ public interface JacocoViolationRule { | |
* List of elements that should be excluded from check. Names can use wildcards (* and ?). | ||
* If left empty, no elements will be excluded. Defaults to an empty list. | ||
*/ | ||
@Input | ||
List<String> getExcludes(); | ||
|
||
/** | ||
* Gets all limits defined for this rule. Defaults to an empty list. | ||
*/ | ||
@Nested | ||
List<JacocoLimit> getLimits(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think this works (but I would need to check...). I think we would end up looking for annotations on There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good point. Will use |
||
|
||
/** | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would make more sense for these to be integers and explain what they mean based on the context of whichever element they're in.
There are 5 possible values, 3 are "counts" (so must be integers) and 2 are ratios (which could be doubles). We could just as easily represent a ratio of 1.0 as a percentage of 100%.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am going to use
BigDecimal
in accordance to Maven JaCoCo plugin.