You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Detekt has experimental support for rules that rely on type resolution.
The gradle plugin seems to have support for this. The CLI tool looks like it requires the --jvm-target and --classpath arguments to be provided. Are those paths available during the bazel compilation phase? Is it possible that the bazel rules could support these type-resolution rules?
Definitely an interesting option. It was not pursued at this point since it requires Kotlin code compilation before executing Detekt. Right now it can be executed without ready-to-use classpath. At the same time, I’m not sure if there are rules using this in the first place, a lot of bundled ones use regular UAST.
I’m not sure if there are rules using this in the first place
The main one I had in mind is IgnoredReturnValue, which would be extremely helpful in catching common errors when dealing with immutable data structures and Result types
Activity
arturdryomov commentedon Feb 1, 2021
Definitely an interesting option. It was not pursued at this point since it requires Kotlin code compilation before executing Detekt. Right now it can be executed without ready-to-use classpath. At the same time, I’m not sure if there are rules using this in the first place, a lot of bundled ones use regular UAST.
[-]Feature request: support for type resolution[/-][+]Support Detekt rules using type resolution[/+]ryanpbrewster commentedon Sep 3, 2021
The main one I had in mind is IgnoredReturnValue, which would be extremely helpful in catching common errors when dealing with immutable data structures and
ResulttypesKernald commentedon Oct 25, 2021
ForbiddenMethodCall is another quite useful one (e.g. preventing stray calls to
printlnand friends) that requires type resolution.ryanulep commentedon Sep 2, 2025
Agree with the above. Having a classpath and jvm_target field could help so that these get caught when the target is tested.
ryanulep commentedon Mar 18, 2026
#207 should address this.