-
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
Excluded annotated methods not ignored in Sonar #703
Comments
Hi, do I understand correctly that the marked function is missing in the xml report, but it is still displayed in Sonar? |
Hi shanshin, thanks for your reply! Yes that's correct. Sonar interprets the absence of any report on a class as "Uncovered". When I run the xmlReport for the following example: @Composable
fun MyComposeTest() {
Text("some text")
} MyComposeTest is not added to the reportDebug.xml file. This is what Sonar reports: When I add the extra UIData class at the top: data class UIData(
val someData: String
)
@Composable
fun MyComposeTest() {
Text("some text")
} This is what the XML file report looks like: <class name="com/abcd/xyz/tools/ui/UIData" sourcefilename="MyComposeTest.kt">
<method name="<init>" desc="(Ljava/lang/String;)V">
<counter type="INSTRUCTION" missed="7" covered="0"/>
<counter type="BRANCH" missed="0" covered="0"/>
<counter type="LINE" missed="2" covered="0"/>
</method> When Sonar receives this report, it shows that everything else is ignored except for the Surprisingly, Jacoco's Thank you for looking into this. |
@lawfulpepper, it seems that this is a feature of Sonar, it additionally analyze the classes present in the project. If it is not possible to exclude classes by annotation now, then it may be worth to create such a feature request on the Sonar issue tracker.
As far as I understand, this was added to Sonar so that its behavior coincides with JaCoCo, because it also does not show classes marked with an annotation containing the word |
Hi @shanshin , thanks for looking into this. Could you point me to where the XML report generation tool is used in the Kover codebase? I'll close this comment and try to see if there's a way to override the behavior internally. Thanks |
This is related to Issue #576.
Applies to version 0.8.3 and 0.9.0-RC.
I have Kover XML reports setup with Sonar.
Unfortunately excluding
@Composable
functions are not excluded in the Sonar coverage report.If ignored, the
@Composable
is not added to the Kover XML report.However, adding a simple Data Class in the same file causes Sonar to understand that this function should be ignored. Adding the Data Class adds the file to the XML report because of the uncovered Data Class.
In the other issue, you had asked them if the XML report is used with Sonar. For us, yes, we are using the xml report path with Sonar.
Thanks!
The text was updated successfully, but these errors were encountered: