Ty Smith
08/10/2023, 7:14 PM@Suppress("SharedBanner:com.foo.x", "SharedBanner:com.bar.y")
to allow specific suppressions without doing the entire thing. Any thoughts on approaching this with the current detekt APIs or would this need to be a change upstream? I imagine the scenario might exist today using config files with the default rules if someone suppresses banned imports, but only for 1 import and then they accidentally get a second one they are not warned about.Brais Gabin
08/10/2023, 7:34 PMBrais Gabin
08/10/2023, 7:35 PMBrais Gabin
08/10/2023, 7:36 PMBrais Gabin
08/10/2023, 7:37 PMgammax
08/11/2023, 2:19 PMTy Smith
08/15/2023, 7:22 PMgammax
08/15/2023, 10:44 PMgammax
08/15/2023, 10:47 PMissue
with different IDs (see https://github.com/detekt/detekt-custom-rule-template/blob/1066ffd07e0d41d3d9e54f059c9a790efebdff4c/src/main/kotlin/org/example/detekt/MyRule.kt#L13-L18) That will allow you to still keep a single checker but report distinct issues for distinct codesmells
2. Just refactor the checked to have some shared Infra (which I suspect you’ll need) in a separate class, and have separate classes reporting different inspections. The pro of this approach is that if you raise a SmellyStatement
detekt report, most likely you’ll have a SmellyStatementRule.kt
somewhere in your codebase that folks can contribute to (so you’ll have a 1:1 relationship between report ID and filename of the rule).