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

Formatter breaks class with trailing comment #728

Closed
scottdweber opened this issue Apr 20, 2020 · 3 comments
Closed

Formatter breaks class with trailing comment #728

scottdweber opened this issue Apr 20, 2020 · 3 comments
Labels

Comments

@scottdweber
Copy link

Given a class that is defined like this:

class CoolThing (
    val thing1: String,
    val thing2: String
) // this is a comment
{
    // ...
}

Expected Behavior

When running the ktlint formatter, output should be:

class CoolThing (
    val thing1: String,
    val thing2: String
) {
    // this is a comment
    // ...
}

Observed Behavior

Actual output (0.36.0) is a class that no longer compiles:

class CoolThing (
    val thing1: String,
    val thing2: String
) // this is a comment {
    // ...
}

Your Environment

  • Version of ktlint used: 0.36.0
  • Name and version (or code for custom task) of integration used (Gradle plugin, Maven plugin, command line, custom Gradle task): org.jlleitschuh.gradle:ktlint-gradle:9.2.1
  • Version of Gradle used (if applicable): 5.6
  • Operating System and version: macOS
@shashachu shashachu added the bug label Apr 22, 2020
@shashachu
Copy link
Contributor

@scottdweber could you do me a favor and just run lint (not format) with --verbose to see which rule it is that's making that change? (I'm unsure how to pass that flag with the plugin, but I assume it's supported).

@scottdweber
Copy link
Author

Looks like it is curly-spacing

@romtsn
Copy link
Collaborator

romtsn commented May 23, 2020

Fixed by #730

@romtsn romtsn closed this as completed May 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants