Using editorConfigOverride in kotlinGradle ktlint removes its default values, changing behavior
- Lingua principale
- Java
- Stelle
- 5.6k
- Fork
- 559
- Merge medio
- 1g 13h
- PR unite (30g)
- 34
Descrizione
When you use `editorConfigOverride` with map that has at least 1 entry, for example with arbitrary key that doesn't exist:
```gradle.kts
spotless {
kotlinGradle {
target("*.gradle.kts")
ktlint("1.3.1").editorConfigOverride(
mapOf(
"abc" to "abc",
),
)
}
}
```
the default behavior changes. For example, when I fail the `no-consecutive-comments` rule by having this in `build.gradle.kts`:
```gradle.kts
/** Deps */
// Dep1
```
after adding the map with 1 element, `./gradlew spotlessApply` will no longer display the error, and will successfully format the file.
```
> Task :spotlessApply
BUILD SUCCESSFUL in 220ms
6 actionable tasks: 3 executed, 3 up-to-date
15:25:53: Execution finished 'spotlessApply'.
```
With empty map, it finishes with error:
```
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':spotlessKotlinGradle'.
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.lambda$executeIfValid$1(ExecuteActionsTaskExecuter.java:130)
...
Caused by: java.lang.AssertionError: Error on line: 20, column: 5
rule: standard:no-consecutive-comments
an EOL comment may not be preceded by a KDoc. Reversed order is allowed though when separated by a newline.
at com.diffplug.spotless.glue.ktlint.compat.KtLintCompatReporting.report(KtLintCompatReporting.java:23)
at com.diffplug.spotless.glue.ktlint.compat.KtLintCompat1Dot0Dot0Adapter$FormatterCallback.invoke(KtLintCompat1Dot0Dot0Adapter.java:77)
at com.diffplug.spotless.glue.ktlint.compat.KtLintCompat1Dot0Dot0Adapter$FormatterCallback.invoke(KtLintCompat1Dot0Dot0Adapter.java:72)
at com.pinterest.ktlint.rule.engine.internal.CodeFormatter.format(CodeFormatter.kt:31)
at com.pinterest.ktlint.rule.engine.api.KtLintRuleEngine.format(KtLintRuleEngine.kt:116)
...
```
Versions:
Gradle 8.9
id("com.diffplug.spotless") version "7.0.0.BETA1"
Windows 10
Guida per i contributori
Apri la guida per i contributori
Valutazione
Questa issue non è ancora stata valutata.