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 #5366
Comments
Possibly related to #5259, though I haven't confirmed. |
Oh... I found the reason why. This bug is already resolved in #5312 The exact bug spec is if the FunctionSignature is active, indent size is changed to 4(FunctionSignature indentSize config) for later formatting rules
When Line 41 in 283da9e
detekt/detekt-formatting/src/main/kotlin/io/gitlab/arturbosch/detekt/formatting/FormattingRule.kt Lines 69 to 78 in 283da9e
And thanks to #5312 this bug is resolved. (editorConfigProperties is not global anymore) |
I'm still seeing this behavior in RC2 (not sure if #5312 is included in that build or not) |
This issue is stale because it has been open 90 days with no activity. Please comment or this will be closed in 7 days. |
Was this released as part of 1.22.0? |
RC2 and the final 1.22.0 release used ktlint 0.47.1, so if you still saw the issue in RC2 it's likely not fixed in the final release. It would be great if you can reconfirm on the snapshot version of detekt (which uses ktlint 0.48.1). |
Looks like the original issue is resolved. Not sure if I should file a separate issue for this, but with the latest snapshot:
gets corrected to:
and
gets corrected to:
|
I think a separate defect if that's ok - and can you please confirm in that issue whether ktlint does this when run directly (and if it does, it should be raised with ktlint project instead of detekt), thanks! |
x-posting from pinterest/ktlint#1661 because ktlint itself isn't the issue
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
The issue can be seen 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 signatureContrast this with running
ktlint "repro/src/**/*.kt" --experimental -F
which only auto formats theFunctionSignature
violation.Your Environment
Detekt 1.22.0-RC1
Gradle 7.5.1
Kotlin 1.7.10
The text was updated successfully, but these errors were encountered: