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

Variable declaration is breaking #2475

Closed
paulocoutinhox opened this issue Dec 30, 2023 · 4 comments
Closed

Variable declaration is breaking #2475

paulocoutinhox opened this issue Dec 30, 2023 · 4 comments

Comments

@paulocoutinhox
Copy link

Expected Behavior

image

Before upgrade ktlint, it is equal red part, now it break after variable declaration.

Observed Behavior

Before upgrade ktlint, it is equal red part, now it break after variable declaration.

Your Environment

[*.{kt,kts}]
ktlint_standard_argument-list-wrapping = disabled
ktlint_standard_trailing-comma-on-call-site = disabled
ktlint_standard_trailing-comma-on-declaration-site = disabled
@paul-dingemans
Copy link
Collaborator

This is intended behavior of https://pinterest.github.io/ktlint/latest/rules/standard/#multiline-expression-wrapping. In case you have upgraded from ktlint 0.x to 1.x you might have missed the change of the default code style, see https://pinterest.github.io/ktlint/latest/rules/code-styles/

@paul-dingemans paul-dingemans closed this as not planned Won't fix, can't repro, duplicate, stale Dec 31, 2023
@paulocoutinhox
Copy link
Author

Ok, how i can disable it? I tried:

[*.{kt,kts}]
ktlint_standard_argument-list-wrapping = disabled
ktlint_standard_trailing-comma-on-call-site = disabled
ktlint_standard_trailing-comma-on-declaration-site = disabled
ktlint_standard_multiline-expression-wrapping = disabled

But it generate an error:

Exception in thread "main" java.util.concurrent.ExecutionException: java.lang.IllegalStateException: Skipping rule(s) which are depending on a rule which is not loaded. Please check if you need to add additional rule sets before creating an issue.
  - Rule with id 'RuleId(value=standard:string-template-indent)' requires rule with id 'RuleId(value=standard:multiline-expression-wrapping)' to be loaded
	at java.base/java.util.concurrent.FutureTask.report(FutureTask.java:122)
	at java.base/java.util.concurrent.FutureTask.get(FutureTask.java:191)
	at com.pinterest.ktlint.cli.internal.KtlintCommandLine.parallel(KtlintCommandLine.kt:716)
	at com.pinterest.ktlint.cli.internal.KtlintCommandLine.parallel$default(KtlintCommandLine.kt:679)
	at com.pinterest.ktlint.cli.internal.KtlintCommandLine.lintFiles(KtlintCommandLine.kt:423)
	at com.pinterest.ktlint.cli.internal.KtlintCommandLine.run(KtlintCommandLine.kt:303)
	at com.pinterest.ktlint.Main.main(Main.kt:35)
Caused by: java.lang.IllegalStateException: Skipping rule(s) which are depending on a rule which is not loaded. Please check if you need to add additional rule sets before creating an issue.
  - Rule with id 'RuleId(value=standard:string-template-indent)' requires rule with id 'RuleId(value=standard:multiline-expression-wrapping)' to be loaded
	at com.pinterest.ktlint.rule.engine.internal.rulefilter.RunAfterRuleFilter.filter(RunAfterRuleFilter.kt:77)
	at com.pinterest.ktlint.rule.engine.internal.rulefilter.RuleFilterKt.applyRuleFilters(RuleFilter.kt:15)
	at com.pinterest.ktlint.rule.engine.internal.RuleExecutionContext$Companion.createRuleExecutionContext$ktlint_rule_engine(RuleExecutionContext.kt:192)
	at com.pinterest.ktlint.rule.engine.api.KtLintRuleEngine.format(KtLintRuleEngine.kt:134)
	at com.pinterest.ktlint.cli.internal.KtlintCommandLine.format(KtlintCommandLine.kt:485)
	at com.pinterest.ktlint.cli.internal.KtlintCommandLine.process(KtlintCommandLine.kt:471)
	at com.pinterest.ktlint.cli.internal.KtlintCommandLine.access$process(KtlintCommandLine.kt:57)
	at com.pinterest.ktlint.cli.internal.KtlintCommandLine$lintFiles$3.invoke$lambda$0(KtlintCommandLine.kt:411)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
	at java.base/java.lang.Thread.run(Thread.java:1583)

@paul-dingemans
Copy link
Collaborator

You're almost there. As indicated in the stacktrace there is another rule that needs to be disabled ktlint_standard_string-template-indent. If you do no want to disable that specific rule, please see this issue.

@paulocoutinhox
Copy link
Author

Thanks @paul-dingemans.

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