detekt / detekt-intellij-plugin

detekt plugin for IntelliJ
https://plugins.jetbrains.com/plugin/10761-detekt
Apache License 2.0
297 stars 39 forks source link

All rules marked with @RequiresTypeResolution annotation cannot be recognized #499

Open ljcmeng opened 10 months ago

ljcmeng commented 10 months ago

Hello, I found that all rules marked with @RequiresTypeResolution cannot be recognized. Such as ForbiddenVoid The reason is that no CompilerSpec configuration is provided when initializing ProcessingSpec. There is a classpath configuration item that I don’t know how to fill in. Does anyone know if this is "by design" or "bug"?

arturbosch commented 9 months ago

The plugin was started before detekt supported type resolution. One could say, it is "by design" to not slow down the analysis as every change triggers a whole detekt run like using it from the cli. Idea and detekt both bundle different Kotlin compilers which do not work nice together at runtime. Therefore, the Intellij plugin only uses detekt's api module and service loaders to start detekt. Using the embedded Kotlin compiler classes directly will lead to classloader problems.

One could try to determine the classpath via some IntelliJ api and pass it to the spec.