spotless
spotless copied to clipboard
setEditorConfigPath caches in memory?
Repro
-
Setup:
- Clone https://github.com/cashapp/paparazzi at d146c97
- Apply this patch:
Patch
Subject: [PATCH] Sync up spotless.kotlin.ktlint config overrides with .editorconfig and use a single source of truth. --- Index: .editorconfig IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== diff --git a/.editorconfig b/.editorconfig --- a/.editorconfig (revision d146c9739e3f434ef0c196061ce66e26ba20bff5) +++ b/.editorconfig (date 1702209972810) @@ -5,9 +5,12 @@ charset = utf-8 trim_trailing_whitespace = true insert_final_newline = true +max_line_length = 70 end_of_line = lf [*.{kt, kts}] ij_kotlin_imports_layout = *,java.**,javax.**,kotlin.**,kotlinx.**,^ +ij_kotlin_allow_trailing_comma = false +ij_kotlin_allow_trailing_comma_on_call_site = false -ktlint_standard_argument-list-wrapping = disabled \ No newline at end of file +ktlint_standard_argument-list-wrapping = disabled Index: build.gradle IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== diff --git a/build.gradle b/build.gradle --- a/build.gradle (revision d146c9739e3f434ef0c196061ce66e26ba20bff5) +++ b/build.gradle (date 1702209773198) @@ -92,18 +92,7 @@ spotless { kotlin { target("src/**/*.kt") - // ktlint doesn't honour .editorconfig yet: https://github.com/diffplug/spotless/issues/142 - ktlint(libs.versions.ktlint.get()).editorConfigOverride([ - 'insert_final_newline': 'true', - 'end_of_line': 'lf', - 'charset': 'utf-8', - 'indent_size': '2', - 'trim_trailing_whitespace': 'true', - 'ij_kotlin_imports_layout': '*,java.**,javax.**,kotlin.**,kotlinx.**,^', - 'ij_kotlin_allow_trailing_comma': 'false', - 'ij_kotlin_allow_trailing_comma_on_call_site': 'false', - 'ktlint_standard_argument-list-wrapping': 'disabled', - ]) + ktlint(libs.versions.ktlint.get()).setEditorConfigPath(rootProject.file(".editorconfig")) } } }-
gradlew :paparazzi:spotlessKotlin - Should pass without any problems.
-
Control:
- Change
.editorconfigby addingmax_line_length = 70 -
gradlew :paparazzi:spotlessKotlin - Should fail with
Exceeded max line length (70)
- Change
-
Problem:
- Change:
max_line_lengthto71 -
gradlew :paparazzi:spotlessKotlin - Expected: fail with
Exceeded max line length (71)
Actual: fail withExceeded max line length (70)
- Change:
-
Investigation
-
gradlew --stop -
gradlew :paparazzi:spotlessKotlin - Now it fails with
Exceeded max line length (71)
-
Spotless version: 6.23.3 ktlint version: 0.50.0 (but I think it's the same with 1.0, because I'm trying to update to that versions and couldn't figure out why it wasn't doing what I tell it to.) Gradle version: 8.5 OS: Windows 10
May related to #1924.
Yeah, looks like a dupe. "Disable rule" vs "edit random line" is the same thing.
Duplicate of #1924