Kotlin file exclusion from Sonar Report

Hi,
I want to exclude some of the Kotlin class files from Sonar(i.e companion object, data class and inner class )

  • I am Using SonarQube (sonarqube-8.2.0.32929 community edition)

Please do help on this how to exclude this ones

Hi Ganesh,

Have you read our documentation on Narrowing the Focus? It will tell you how to exclude files from analysis.

Hi Jeff,

I have gone through the documentation, as a class I can do as stated in there. Where as in my case say for example

class Sample{

companion object{
}
data class{
}
class sampl1{
}
}
So here I want to exclude the inner class item(i.e sampl1, data class, companion object)

Hi Ganesh,

To be more specific, pay heed to the section “Ignore Issues in Blocks” – this covers a mechanism by which you can use patterns to delineate blocks of code in which issue detection should be suppressed. I believe this could work in your case to ignore the portion of your code files using the “data class” construct. Give it a shot and report back!