bazel_rules_detekt
bazel_rules_detekt copied to clipboard
Support Detekt rules using type resolution
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
ForbiddenMethodCall is another quite useful one (e.g. preventing stray calls to println
and friends) that requires type resolution.