Skip to content

fix: silence detekt multiplatform type-resolution compiler-error noise#17

Closed
rasros wants to merge 2 commits into
mainfrom
fix/detekt-mpp-type-resolution-noise
Closed

fix: silence detekt multiplatform type-resolution compiler-error noise#17
rasros wants to merge 2 commits into
mainfrom
fix/detekt-mpp-type-resolution-noise

Conversation

@rasros

@rasros rasros commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

What changed

  • Disable detekt's multiplatform type-resolution tasks (detektMainJvm/detektTestJvm) in com.eignex.lint, gated on the Kotlin Multiplatform plugin.

Why

On a Kotlin Multiplatform project, detekt's per-compilation type-resolution tasks compile every source set merged into a single module, without the kotlinx-serialization compiler plugin or the K2 fragment structure the real build uses. So @Serializable (the synthetic .serializer()) and expect/actual pairs resolve as errors, and detekt prints "N compiler errors found during analysis. This affects accuracy of reporting." The notice never fails the build, but it clutters output and degrades type-rule accuracy on exactly the files it can't resolve. This mirrors detekt's own detekt.multiplatform.disabled property, which can't be set from a precompiled-script plugin.

The per-source-set tasks (PSI-based) still enforce every rule this config enables, so multiplatform projects lose no active coverage. JVM-only projects are untouched — they have no expect/actual, and UnnecessaryFullyQualifiedName relies on their correctly-resolved type-resolution tasks.

Testing

  • ./gradlew test green (incl. the JVM UnnecessaryFullyQualifiedName fails detektMain test, confirming JVM type-resolution tasks are unaffected).
  • Verified against klause (a KMP consumer) via mavenLocal: with the patched plugin, detektMainJvm is disabled and :klause:check runs clean with no "compiler errors found during analysis" notice.

@rasros

rasros commented Jun 16, 2026

Copy link
Copy Markdown
Contributor Author

Closing: the fix would have disabled detekt's type-resolution tasks, which silently drops UnnecessaryFullyQualifiedName on KMP projects. The 'compiler errors found during analysis' notice is cosmetic (it doesn't disable the rule; only reduces accuracy on the few @Serializable/expect-actual files), and no detekt release (incl. 2.0.0-alpha.4) resolves the KMP analysis-compile gap. Leaving the warning in place rather than adding brittle fragment-args machinery to the shared plugin.

@rasros rasros closed this Jun 16, 2026
@rasros rasros deleted the fix/detekt-mpp-type-resolution-noise branch June 16, 2026 08:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant