-
Notifications
You must be signed in to change notification settings - Fork 52
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
Added extended reports filtering #581
Conversation
|
||
@Option( | ||
name = "--excludeInheritedFrom", | ||
usage = "filter to exclude classes inheriting the specified class or implementing an interface, wildcards `*` and `?` are acceptable", |
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.
[nit] since you differ class and interface, maybe its better to use standard JVM terminology "... extending the specified class or implementing an interface"
@@ -186,17 +186,62 @@ public static class ClassFilters { | |||
*/ | |||
public final Set<String> excludeClasses; | |||
|
|||
/** | |||
* Classes that have at least one of the annotations specified in this field are presents in the report. | |||
* All other classes that are not marked with at least one of the specified annotations are not included in the report. |
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.
What happens when both excludeAnnotation
and includeAnnotation
are specified? I know it is mentioned in markdown docs, but it would nice to have it here also
kover-features-jvm/src/main/java/kotlinx/kover/features/jvm/KoverLegacyFeatures.java
Outdated
Show resolved
Hide resolved
@@ -46,12 +46,19 @@ koverReport { | |||
packages("com.another.subpackage") | |||
// excludes all classes and functions, annotated by specified annotations (with BINARY or RUNTIME AnnotationRetention), wildcards '*' and '?' are available | |||
annotatedBy("*Generated*") | |||
// exclude all classes that inherit the specified class or implement the specified interface | |||
inheritedFrom("*Repository") |
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.
You specified inheritedFrom("*Repository")
in both excludes and includes. This makes the example very strange.
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.
Also, these docs should be fully rewritten
@@ -37,18 +38,50 @@ internal class ReportAnnotationFilterTests { | |||
} | |||
} | |||
} | |||
} | |||
|
|||
class Foo : AutoCloseable { |
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 do not see this class being used in test, accidental leftover?
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.
Dark experiments )))
...t/kotlin/kotlinx/kover/gradle/plugin/test/functional/cases/ReportInheritedFromFilterTests.kt
Show resolved
Hide resolved
...t/kotlin/kotlinx/kover/gradle/plugin/test/functional/cases/ReportInheritedFromFilterTests.kt
Show resolved
Hide resolved
* inheritedFrom("*Repository") | ||
* ``` | ||
* | ||
* **_Does not work for JaCoCo_** |
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 believe that the fact that this doesn't work for JaCoCo should be mentioned in the text in this section: https://github.com/Kotlin/kotlinx-kover/blob/main/kover-gradle-plugin/docs/configuring.md#reports-filtering
Actually, this whole block:
It is acceptable to filter a class from the report by its fully-qualified name - using classes or packages. Also acceptable to filter a class, function or getter marked with the specified annotation - annotatedBy.
needs to be expanded with a new functionality
Tests will fail for now, until reporter be fixed |
And when reporter will be fixed? |
6e49c2e
to
198a96d
Compare
Co-authored-by: Leonid Startsev <sandwwraith@users.noreply.github.com>
kover-cli/docs/index.md
Outdated
| --excludeInheritedFrom <exclude-ancestor-name> | filter to exclude classes extending the specified class or implementing an interface, wildcards `*` and `?` are acceptable | | + | | ||
| --includeInheritedFrom <include-ancestor-name> | filter to include only classes extending the specified class or implementing an interface, wildcards `*` and `?` are acceptable | | + | | ||
| --html <html-dir> | generate a HTML report in the specified path | | | | ||
| --include <class-name> | filter to include classes, wildcards `*` and `?` are acceptable | | + | |
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.
Shouldn't it be placed next to --exclude
?
kover-cli/docs/index.md
Outdated
| --include <class-name> | filter to include classes, wildcards `*` and `?` are acceptable | | + | | ||
| --src <sources-path> | location of the source files root | + | + | | ||
| --title <html-title> | title in the HTML report | | | | ||
| --xml <xml-file-path> | generate a XML report in the specified path | | | |
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.
What happens if I specify both --xml
and --html
? Both reports will be generated?
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.
Yep
kover-cli/src/main/kotlin/kotlinx/kover/cli/commands/ReportCommand.kt
Outdated
Show resolved
Hide resolved
...t/kotlin/kotlinx/kover/gradle/plugin/test/functional/cases/ReportInheritedFromFilterTests.kt
Show resolved
Hide resolved
...t/kotlin/kotlinx/kover/gradle/plugin/test/functional/cases/ReportInheritedFromFilterTests.kt
Show resolved
Hide resolved
kover-gradle-plugin/src/main/kotlin/kotlinx/kover/gradle/plugin/dsl/KoverReportsConfig.kt
Show resolved
Hide resolved
/** | ||
* Filter classes extending at least one of the specified classes or implementing at least one of the interfaces. | ||
* | ||
* The entire inheritance tree is analyzed, that is, a class may not extend the specified class directly. |
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.
Copy my comments from the similar section in docs
Co-authored-by: Leonid Startsev <sandwwraith@users.noreply.github.com>
* | ||
* | ||
* The entire inheritance tree is analyzed; a class may inherit the specified class/interface indirectly and still be included in the report, unless the specified class/interface is located outside of the application (see below). | ||
* The entire inheritance tree is analyzed; a class may inherit the specified class/interface indirectly and still be included in the report, unless the specified class/interface is located outside the application (see below). |
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.
of
removal was unnecessary
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 just wanted the IDEA to stop highlighting this text :)
Moot point, but I will return of
. As I understand it, both options are acceptable.
kover-gradle-plugin/src/main/kotlin/kotlinx/kover/gradle/plugin/dsl/KoverReportsConfig.kt
Outdated
Show resolved
Hide resolved
kover-gradle-plugin/src/main/kotlin/kotlinx/kover/gradle/plugin/dsl/KoverReportsConfig.kt
Outdated
Show resolved
Hide resolved
* inheritedFrom("*Repository") | ||
* ``` | ||
* | ||
* **_Does not work for JaCoCo_** |
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 believe this note should be placed before the example
* inheritedFrom("*Repository") | ||
* ``` | ||
* | ||
* **_Does not work for JaCoCo_** |
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.
Move before the example
Co-authored-by: Leonid Startsev <sandwwraith@users.noreply.github.com>
The following report filtering features have been implemented:
Resolves #274
Resolves #454