detekt / sonar-detekt

SonarQube plugin for Kotlin
https://detekt.dev
GNU Lesser General Public License v3.0
492 stars 52 forks source link

NPE during sonarqube run #160

Closed 5V715 closed 1 year ago

5V715 commented 1 year ago

How can i disable to whole formatting RuleSet that is somehow pulled in. i cannot configure it in sonarqube itself. i'd like to remove all ktlint related things (FormattingRules) since it's handled elsewhere. In one of our projects running ktlint from detekt fails.

Analyzing XYZ.kt led to an exception. 
  The original exception message was: null
  Running detekt '1.19.0' on Java '11.0.16.1+1' on OS 'Linux'
  If the exception message does not help, please feel free to create an issue on our GitHub page.
at io.gitlab.arturbosch.detekt.core.AnalyzerKt.throwIllegalStateException(Analyzer.kt:162)
    at io.gitlab.arturbosch.detekt.core.AnalyzerKt.access$throwIllegalStateException(Analyzer.kt:1)
    at io.gitlab.arturbosch.detekt.core.Analyzer.runSync(Analyzer.kt:70)
    at io.gitlab.arturbosch.detekt.core.Analyzer.run(Analyzer.kt:52)
    at io.gitlab.arturbosch.detekt.core.tooling.Lifecycle$analyze$result$1.invoke(Lifecycle.kt:45)
    at io.gitlab.arturbosch.detekt.core.tooling.Lifecycle$analyze$result$1.invoke(Lifecycle.kt:42)
    at io.gitlab.arturbosch.detekt.core.util.PerformanceMonitor.measure(PerformanceMonitor.kt:42)
    at io.gitlab.arturbosch.detekt.core.tooling.Lifecycle$DefaultImpls.measure(Lifecycle.kt:32)
    at io.gitlab.arturbosch.detekt.core.tooling.Lifecycle$DefaultImpls.analyze(Lifecycle.kt:42)
    at io.gitlab.arturbosch.detekt.core.tooling.DefaultLifecycle.analyze(Lifecycle.kt:59)

with

Caused by: kotlin.KotlinNullPointerException
    at com.pinterest.ktlint.ruleset.standard.IndentationRule.rearrangeBlock(IndentationRule.kt:202)
    at com.pinterest.ktlint.ruleset.standard.IndentationRule.access$rearrangeBlock(IndentationRule.kt:103)
    at com.pinterest.ktlint.ruleset.standard.IndentationRule$rearrange$1.invoke(IndentationRule.kt:172)
    at com.pinterest.ktlint.ruleset.standard.IndentationRule$rearrange$1.invoke(IndentationRule.kt:170)
    at com.pinterest.ktlint.core.ast.PackageKt.visit(package.kt:225)
    at com.pinterest.ktlint.core.ast.PackageKt.visit(package.kt:226)
    at com.pinterest.ktlint.core.ast.PackageKt.visit(package.kt:226)
arturbosch commented 1 year ago

Duplicate of #161