diff-coverage-gradle
diff-coverage-gradle copied to clipboard
There are two reasons for the error in the total instruction number:
- The current method of ignoring instructions based on the number of code changes has issues. The current logic only ignores bytecode in LINENUMBER node blocks, leading to some unforeseen situations in Kotlin. I have submitted a pull request that ignores all Linenumber bytecode within a method that is not part of the code changes. This adjustment yields the desired result in the graph.
Before
After
- The algorithm for determining the result line numbers of code changes also contributes to miscalculating the total line number. Applying the 'ignore space' differential strategy could prove beneficial in this scenario.
For example:
'git diff' default output is,
--- a/app/src/main/java/org/angmarch/jacococompose/ComposeComponent.kt +++ b/app/src/main/java/org/angmarch/jacococompose/ComposeComponent.kt @@ -16,4 +16,8 @@ fun ComposeComponent(text: String) {
Surface {
Text(text = text)
}
+} <- this would cause wrong instruction being retained in pull request coverage report.
+
+fun catchMeIfYouCan() {
+ println("I'm a testable function")
}
A more favorable outcome could be achieved by issuing the command 'git diff -b' to ignore space changes.
--- a/app/src/main/java/org/angmarch/jacococompose/ComposeComponent.kt +++ b/app/src/main/java/org/angmarch/jacococompose/ComposeComponent.kt @@ -17,3 +17,7 @@ fun ComposeComponent(text: String) {
Text(text = text)
}
}
+
+fun catchMeIfYouCan() {
+ println("I'm a testable function")
+}
Hi @skyevil12
I'm the author of this plugin. I have an independent fork of the plugin that is actively maintained. Could you please create the same PR in my repo?
Sure, just create PR in another repo.