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

False (confusing?) positive: Expected a newline before comment (standard:enum-wrapping) #2510

Closed
scottkennedy opened this issue Jan 24, 2024 · 1 comment · Fixed by #2527
Closed
Milestone

Comments

@scottkennedy
Copy link

Expected Behavior

There is a newline before every comment, so either this is a false positive, or it's giving the wrong error.

Observed Behavior

Sample.kt:1:36 Expected a newline before comment (standard:enum-wrapping)

Steps to Reproduce

enum class Sample(val key: String) {

    // https://docs.google.com/...

    // Foo
    Foo("bar"),
}

Running the ktlint formatter removes the first blank line in the file (between enum class and the first comment), but it still fails the check with the same error.

Your Environment

  • Version of ktlint used: 1.1.1
  • Relevant parts of the .editorconfig settings: None
  • Name and version (or code for custom task) of integration used (Gradle plugin, Maven plugin, command line, custom Gradle task): https://github.com/JLLeitschuh/ktlint-gradle 12.1.0
  • Version of Gradle used (if applicable): 8.5
  • Operating System and version: MacOS 14.3
@paul-dingemans
Copy link
Collaborator

Tnx for reporting. This is indeed a bug. It seems to be caused by the blank line between the two EOL-comments. Without that blank line no violation is reported.

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

Successfully merging a pull request may close this issue.

2 participants