jeremymailen / kotlinter-gradle

Painless, fast ktlint plugin for Gradle

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Question] The .editorconfig disable role is configurated and still used

Numichi opened this issue · comments

Why not disable the filename Ktlint role from the standard role set?

build.gradle.kts

plugins {
    id("org.jmailen.kotlinter") version "3.14.0"
}

.editorconfig

[*]
indent_size = 4
indent_style = space
trim_trailing_whitespace = false
insert_final_newline = true
max_line_length = 180

[*.{kt,kts}]
ktlint_standard = enabled
ktlint_experimental = enabled
ktlint_standard_filename = disabled

And filename role will be run, and I get: Lint error > [filename] File name mapping.kt' should conform PascalCase.

I tried to configure it from https://pinterest.github.io/ktlint/rules/configuration-ktlint/#disabled-rules

Same here, other rules like ktlint_standard_curly-spacing = disabled also still seem to be applied

I have to disable the filename rule in one of my own projects, so I believe it should work.

Try restarting your Gradle daemon and running it again. I've still gotten bug reports that sometimes it's caching an old editorconfig content.

If that doesn't fix it, please provide repro steps with the location of your .editorconfig file and module directory structure. The kotlinter-gradle plugin is trying to be very hands off with editorconfig at this point (only marking the lint tasks as dirty when editorconfig is changing). We mostly leave it up to the ktlint engine to pick up and process this file.

Indeed after switching branches, cleaning, reimporting the gradle project etc. the disable rule seems to work. However, it's still strange the rules don't get applied immediately.

Yeah, it seems to be a bug. The editorconfig file is supposed to be one of the build inputs such that the lint tasks re-run when it is changed. For some reason that seems to not be happening sometimes.

I'm going to close this issue for the moment since the title might be misleading and make sure to open a bug around editorconfig staleness.