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

IndentationRule: Comment is not indented on the line before elvis operator #1532

Closed
petertrr opened this issue Oct 13, 2022 · 0 comments · Fixed by #1545
Closed

IndentationRule: Comment is not indented on the line before elvis operator #1532

petertrr opened this issue Oct 13, 2022 · 0 comments · Fixed by #1545
Assignees
Labels
bug Something isn't working
Milestone

Comments

@petertrr
Copy link
Member

Consider this example:

fun foo() {
    findProperty("dockerNetwork") as String?
        // https://docs.docker.com/compose/networking/
        ?: "default"
}

Diktat 1.2.3 forces the following code::

fun foo() {
    findProperty("dockerNetwork") as String?
    // https://docs.docker.com/compose/networking/
        ?: "default"
}
@petertrr petertrr added the bug Something isn't working label Oct 13, 2022
@0x6675636b796f75676974687562 0x6675636b796f75676974687562 added this to the 1.2.4 milestone Oct 25, 2022
0x6675636b796f75676974687562 added a commit that referenced this issue Nov 1, 2022
### What's done:

 * Now, EOL and block comments within multi-line Elvis expressions have the same
   indentation level as the immediately following Elvis operator (`?:`), e.g.:
   ```kotlin
   fun foo() {
       findProperty("dockerNetwork") as String?
           // https://docs.docker.com/compose/networking/
           ?: "default"
   }
   ```
 * This fixes #1532.
0x6675636b796f75676974687562 added a commit that referenced this issue Nov 1, 2022
### What's done:

 * Now, EOL and block comments within multi-line Elvis expressions have the same
   indentation level as the immediately following Elvis operator (`?:`), e.g.:
   ```kotlin
   fun foo() {
       findProperty("dockerNetwork") as String?
           // https://docs.docker.com/compose/networking/
           ?: "default"
   }
   ```
 * This fixes #1532.
0x6675636b796f75676974687562 added a commit that referenced this issue Nov 7, 2022
### What's done:

 * Now, EOL and block comments within multi-line Elvis expressions have the same
   indentation level as the immediately following Elvis operator (`?:`), e.g.:
   ```kotlin
   fun foo() {
       findProperty("dockerNetwork") as String?
           // https://docs.docker.com/compose/networking/
           ?: "default"
   }
   ```
 * This fixes #1532.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants