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

Comment after annotations are interpreted as the annotated construct. #736

Closed
mhogerheijde opened this issue May 7, 2020 · 0 comments · Fixed by #740
Closed

Comment after annotations are interpreted as the annotated construct. #736

mhogerheijde opened this issue May 7, 2020 · 0 comments · Fixed by #740

Comments

@mhogerheijde
Copy link

Expected Behavior

No lint-error should be given

Observed Behavior

When placing a comment after the last annotation, I get the error

Multiple annotations should not be placed on the same line as the annotated construct

Steps to Reproduce

Create the following class

import org.junit.Ignore
import org.junit.Test
import org.junit.Assert.fail

class SomeTest {
  @Test
  @Ignore // foobar
  fun testThisShouldBeIgnored() {
    fail("This should not have ran")
  }
}

Run ktLint, it will give the message Multiple annotations should not be placed on the same line as the annotated construct. When you remove // foobar or place it on its own line, no error is shown.

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, version 9.2.1
  • Version of Gradle used (if applicable): Gradle 6.2.1
  • Operating System and version:
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 20.04 LTS
Release:        20.04
Codename:       focal
$ uname -r
5.4.0-29-generic
  • Link to your project (if it's a public repository): private code
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.

1 participant