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
Continuation indent is doubled when indentation and function signature are enabled #1661
Comments
@eygraber Can you please simplify the issue? The current issue description is a mix of Detekt and Ktlint and you are assuming that the problem is caused by Ktlint. I am not familiar with Detekt, so this makes it hard for me to investigate. Also the problem can be caused by the way Detekt invokes Ktlint. Please try to reproduce your problem with the Ktlint CLI (see https://pinterest.github.io/ktlint/install/cli/) only so that we just know whether this issue needs to be investigated by the Ktlint or the Detekt project. Also minimize your example file to contain the least amount of code that displays the problem. Finally, also enclose the expected output. |
OK I followed the cli instructions and when running |
It is not clear to me what exactly you perceive as the problem. Please paste code, formatted as you would have expected it. |
I forgot to configure ktlint the way I have detekt configured 🙈 After doing that, ktlint behaves correctly. I will raise the issue with detekt. |
Tnx for confirming. |
Expected Behavior
I expect a single indent to be used for continuation indents.
The Kotlin style guide migration suggests that:
Observed Behavior
A double indent is being used.
Steps to Reproduce
repro project
I'm using ktlint through detekt, using the command
./gradlew detektMetadataMain
. In between each of these cases, I am runninggit reset --hard
in order to reset the file to original formatting. The rules can be configured in thedetekt.yml
file.Indentation
andFunctionSignature
enabled - two function bodies are moved inline with the signature and indentation is doubled for continuationsIndentation
enabled andFunctionSignature
disabled - no changesIndentation
disabled andFunctionSignature
enabled - two function bodies are moved inline with the signatureYour Environment
The text was updated successfully, but these errors were encountered: