-
Notifications
You must be signed in to change notification settings - Fork 504
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
Rule with id 'RuleId(value=standard:string-template-indent)' requires rule with id 'RuleId(value=standard:multiline-expression-wrapping)' to be loaded #2378
Comments
From #2338:
Next to above, the |
Isn't it possible to reuse the logic without the rule being enabled? I feel like template strings deserve the extra treating. |
From an architectural viewpoint I do not want rules to call methods in other rules. Also extracting logic from Rule classes to other utility classes, or using shared superclasses is not something that I want to do. |
Alright, then I guess the user experience will just suffer from this. |
I sympathize with @paul-dingemans viewpoint about the challenges these choices present both technically and conceptually. On a smaller scale, I've experienced similar tradeoffs managing my open source project and there have been, frankly, features I've avoided which users desire, but I my intuition tells me would create a lot of tangles and headaches. Some questions worth asking though that might be helpful for perspective:
|
Rule dependencies have been introduced to avoid inconsistenties. In several occasions conflicts between rules were reported where two different rules did not agree about the way how an element had to be formatted. Some of those problems were caused by a non-deterministic order in which the rules were executed. Rule ordering can not be hard coded in ktlint as API Consumers determine which rules are executed. Also, there is a need to support third party rule sets which can have depencies on standard rules. A non-deterministic order of executing the rules, can lead to endless loops where formatting of element would alternates between the different ways of formatting. With the rule dependencies it can be made explicit that a rule can only be executed after another specific rules has been executed before. From a technical perspective, a rule dependency can also be used to 'solve' the problem of repeating the same/similar logic in multiple rules. Although ktlint allows rules to be disabled on discretion of the user, the intended way of using ktlint is to use the default configuration (e.g. a certain code style). Tuning the ktlint configuration violates the 'anti-bikeshedding` principle of ktlint. If enabling/disabling some rules works for a given project than that is okay. But, I cannot support that any random permutation of rules works.
I don't know. And to be honest, I don't really care about that as well. |
Then what was the motivation for #2371? |
Because we're beginning the bike shedding process of deciding which rules ought to be dependent on others. |
Alright then I'm hoping this will also be considered. 🤞 |
When using the following configuration:
I'm getting:
However I do not want to enable the
multiline-expression-wrapping
rule. Would it be possible to also separate them?The text was updated successfully, but these errors were encountered: