Skip to content

ktlint - ktlint_code_style gets unconditionally overridden to its default value when not defined in editorConfigOverride #2142

Closed
@OlivierGenez

Description

@OlivierGenez

Bug report

Summary

ktlint_code_style gets unconditionally overridden to its default value (intellij_idea) when the editorConfigOverride map is non-empty but does not define it. As a result, it gets overridden even if it's actually
defined in the .editorconfig file.

For example, the following set up will result in ktlint_code_style being set to intellij_idea, although you would expect it to be set to ktlint_official as defined in .editorconfig:

  • .editorconfig:
ktlint_code_style = ktlint_official

# other properties
# ...
  • build.gradle
plugins {
    id 'org.jetbrains.kotlin.jvm' version '1.6.21'
    id 'com.diffplug.spotless'
}

repositories { mavenCentral() }

spotless {
    kotlin {
        ktlint().editorConfigOverride([
            ktlint_test_key: true,
        ])
    }
}

Additional info

  • Gradle version: 8.0.2
  • Spotless version: 6.25.0
  • Operating system: macOS Sonoma 14.5

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions