Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

experimental:spacing-between-declarations-with-comments false positive #865

Closed
romtsn opened this issue Aug 27, 2020 · 0 comments · Fixed by #946
Closed

experimental:spacing-between-declarations-with-comments false positive #865

romtsn opened this issue Aug 27, 2020 · 0 comments · Fixed by #946
Labels

Comments

@romtsn
Copy link
Collaborator

romtsn commented Aug 27, 2020

Expected Behavior

Expect this code to not cause any issues

fun function() {
    with(binding) {
        loginButton.setOnClickListener {
//            comment
            showScreen()
        }
    }
}

Observed Behavior

path/to/file/File.kt:4:1: Declarations and declarations with comments should have an empty space between. (experimental:spacing-between-declarations-with-comments)

Steps to Reproduce

Run lint on the given code snippet, in case of formatting - an empty line will be inserted before the // comment

Your Environment

  • Version of ktlint used: 0.38.0
  • Name and version (or code for custom task) of integration used (Gradle plugin, Maven plugin, command line, custom Gradle task): CLI
@romtsn romtsn added the bug label Aug 27, 2020
t-kameyama added a commit to t-kameyama/ktlint that referenced this issue Oct 19, 2020
…ives

- Fix false positives when a comment is not between declarations (pinterest#865)
- Fix false negatives when declarations in class
t-kameyama added a commit to t-kameyama/ktlint that referenced this issue Oct 19, 2020
…ives

- Fix false positives when a comment is not between declarations (pinterest#865)
- Fix false negatives when declarations is in class
romtsn pushed a commit that referenced this issue Oct 19, 2020
…ives (#946)

- Fix false positives when a comment is not between declarations (#865)
- Fix false negatives when declarations is in class
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant