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

Cannot disable rules using the new syntax #1777

Closed
Nohus opened this issue Jan 15, 2023 · 3 comments
Closed

Cannot disable rules using the new syntax #1777

Nohus opened this issue Jan 15, 2023 · 3 comments

Comments

@Nohus
Copy link

Nohus commented Jan 15, 2023

I'm trying to disable a rule. This editorconfig works fine:

root = true

[*.kt]
disabled_rules=package-name

This is however marked as deprecated and generates a lot of warning. When trying to use the new syntax:

root = true

[*.kt]
ktlint_standard_package-name = disabled

The rule is not disabled. I am running ktlint through the Spotless Gradle plugin: https://github.com/diffplug/spotless/tree/main/plugin-gradle
Running either the spotlessCheck or spotlessApply task.

@paul-dingemans
Copy link
Collaborator

paul-dingemans commented Jan 15, 2023

I believe this is caused by the spotless integration. Spotless specifies the
editorConfigOverride instead of the editorConfigDefault parameter in code block below:

return KtLint.INSTANCE.format(new KtLint.ExperimentalParams(
				name,
				text,
				allRuleProviders,
				userData,
				formatterCallback,
				isScript,
				false,
				EditorConfigDefaults.Companion.getEMPTY_EDITOR_CONFIG_DEFAULTS(),
				editorConfigOverride,
				false));

As a result, the settings in your .editorconfig file are overriden by the configuration specified by Spotless.

Please contact Spotless maintainers and report back here. Most likely this is related to diffplug/spotless#142

@bcmedeiros
Copy link

This use case seems to be working fine for me after diffplug/spotless#1444, make sure you're using plugin-gradle 6.13.0

@Nohus
Copy link
Author

Nohus commented Jan 15, 2023

Thank you, updating the Spotless plugin from 6.12.1 to 6.13.0 resolved the issue.

@Nohus Nohus closed this as completed Jan 15, 2023
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

3 participants