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

Regression: 3.11.1 doesn't seem to read disabled_rules from .editorconfig anymore #262

Closed
henrik242 opened this issue Jun 27, 2022 · 2 comments · Fixed by #265
Closed

Regression: 3.11.1 doesn't seem to read disabled_rules from .editorconfig anymore #262

henrik242 opened this issue Jun 27, 2022 · 2 comments · Fixed by #265

Comments

@henrik242
Copy link

henrik242 commented Jun 27, 2022

After upgrading from 3.10.0 I had to specify disabledRules in the gradle kotlinter { } block instead of relying on disabled_rules in .editorconfig.

@mateuszkwiecinski
Copy link
Collaborator

mateuszkwiecinski commented Jun 27, 2022

Hey @henrik242 👋 Thanks for reporting the issue. Indeed, there were some changes around editorConfig properties, but unfortunately I don't see an obvious mistake in the updated implementation 👀 Plus, I was able to set the disabled_rules in my personal project and it seemed to work in an expected way 🤔

I recall Ktlint had its own config-caching mechanism, which I suspect as the root cause of this issue. Can you try running ./gradlew --stop before running any of kotlinter's tasks?
(so, just to be clear: I'm asking you to revert to old config, with disabled_rules set in .editorconfig only, and then run ./gradlew --stop and then ./gradlew lintKotlin)

@mateuszkwiecinski
Copy link
Collaborator

I can confirm I was able to reproduce the issue, but I'm not yet sure what's the root cause.
My repro steps are:

  1. Run ./gradlew lintKotlin --info
  2. Ensure lintKotlinMain is considered up-to-date
> Task :lintKotlinMain UP-TO-DATE
Build cache key for task ':lintKotlinMain' is 706d61ada5673750e89667db2549469b
Skipping task ':lintKotlinMain' as it is up-to-date.
  1. Modify .editorconfig (i.e. add indent_size = 40)
  2. Run ./gradlew lintKotlin --info
  3. Observe the .editorConfig change was registered by the plugin
> Task :lintKotlinTest
Build cache key for task ':lintKotlinTest' is 1663dabf03d62c9bc84faf002d0b9fa0
Task ':lintKotlinTest' is not up-to-date because:
  Input property 'editorconfigFiles$kotlinter_gradle' file ~/xxxx/.editorconfig has changed.
  1. The build passes ignoring latest .editorconfig change
  2. Run ./gradlew --stop
  3. Run ./gradlew lintKotlin --no-configuration-cache --rerun-tasks
  4. Now I get expected result and the build starts failing

I'll try to cover that with a test on our side, and will either try to fix on plugin side or will report it to ktlint 👀

@henrik242 Please let me know if the workaround I described above also works in your case 👂

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

Successfully merging a pull request may close this issue.

2 participants