Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

setEditorConfigPath caches in memory? #1963

Closed
TWiStErRob opened this issue Dec 10, 2023 · 3 comments
Closed

setEditorConfigPath caches in memory? #1963

TWiStErRob opened this issue Dec 10, 2023 · 3 comments

Comments

@TWiStErRob
Copy link

Repro

  1. Setup:

    1. Clone https://github.com/cashapp/paparazzi at d146c97
    2. 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"))
         }
       }
     }
    1. gradlew :paparazzi:spotlessKotlin
    2. Should pass without any problems.
  2. Control:

    1. Change .editorconfig by adding max_line_length = 70
    2. gradlew :paparazzi:spotlessKotlin
    3. Should fail with Exceeded max line length (70)
  3. Problem:

    1. Change: max_line_length to 71
    2. gradlew :paparazzi:spotlessKotlin
    3. Expected: fail with Exceeded max line length (71)
      Actual: fail with Exceeded max line length (70)
  4. Investigation

    1. gradlew --stop
    2. gradlew :paparazzi:spotlessKotlin
    3. 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

@Goooler
Copy link
Member

Goooler commented Dec 10, 2023

May related to #1924.

@TWiStErRob
Copy link
Author

Yeah, looks like a dupe. "Disable rule" vs "edit random line" is the same thing.

@Goooler
Copy link
Member

Goooler commented Feb 27, 2024

Duplicate of #1924

@Goooler Goooler marked this as a duplicate of #1924 Feb 27, 2024
@Goooler Goooler closed this as not planned Won't fix, can't repro, duplicate, stale Feb 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants