Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Using editorConfigOverride in kotlinGradle ktlint removes its default values, changing behavior

Open
#2,226 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
38/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Stale
Tech stack
kotlin
Domain
build-system

Research direction

Start by reproducing the Gradle Kotlin DSL example with a nonempty editorConfigOverride map and compare it with the empty-map case. Then trace the editorConfigOverride entry point and existing ktlint configuration tests, if present. Done means default ktlint behavior, including no-consecutive-comments, remains enforced when an override contains unrelated keys.

Written by the indexing model from the issue text.

Description

bug-unconfirmed

When you use editorConfigOverride with map that has at least 1 entry, for example with arbitrary key that doesn't exist:

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:

/** 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

Dominant language
Java
Stars
5.7k
Forks
560
Avg merge
1d 13h
Merged PRs (30d)
43

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from diffplug/spotless

All issues in diffplug/spotless

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.