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

How to partially fix deviations where depending rules involed ? #2270

Closed
jbruchanov opened this issue Sep 20, 2023 · 1 comment
Closed

How to partially fix deviations where depending rules involed ? #2270

jbruchanov opened this issue Sep 20, 2023 · 1 comment

Comments

@jbruchanov
Copy link

How to fix issues for example for ktlint_standard_string-template-indent and not ktlint_standard_indent ?

Expected Behavior

I'd like to get fixed issues of more specific rule which depends on some parent rule.
I've tried also use baseline, but it seems like ./ktlint --baseline=baseline.txt -F is fixing everything even the stuff already present in baseline.txt

Observed Behavior

  • Fails due to ktlint_standard_indent = disabled config
  • or I have to enable ktlint_standard_indent which is fixing unwanted issues

Your Environment

  • Version of ktlint used: 1.0.0
  • Relevant parts of the .editorconfig settings
ktlint_standard_indent = disabled
ktlint_standard_string-template-indent = enabled
  • Operating System and version: Ubuntu in Windows
@paul-dingemans
Copy link
Collaborator

I'd like to get fixed issues of more specific rule which depends on some parent rule.

The idea of the parent rules is to reduce internal complexity in ktlint. Per parent-child relation it is determined whether the parent rule must be loaded or not. In case of a mandatory relation, like in this example, there is (or should be) a good reason for it.

I've tried also use baseline, but it seems like ./ktlint --baseline=baseline.txt -F is fixing everything even the stuff already present in baseline.txt

Yes, see #1072 for more backgrounds why it is not trivial to fix.

Observed Behavior
Fails due to ktlint_standard_indent = disabled config
or I have to enable ktlint_standard_indent which is fixing unwanted issues

Ideally, you use the default configuration of a code style. Each of those configuration consist of a balanced set of rules and default settings. By disabling any rule, or changing a default value, you leave the paved road and go into dark territories. If you can find a configuration that works for you, that is great. If the indent rules is fixing unwanted issues, you either have to create issues for that or enable the rule and accept that some indentation is not optional from your viewpoint.

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