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 positive "declarations and declarations with annotations should have an empty space between." #1281

Closed
hgschmie opened this issue Nov 9, 2021 · 0 comments · Fixed by #1291

Comments

@hgschmie
Copy link

hgschmie commented Nov 9, 2021

Expected Behavior

A Kotlin class with asciidoc tag references gets parsed correctly and no error is reported.

Observed Behavior

erroneous messages about 'Declarations and declarations with annotations should have an empty space between.' are reported

Steps to Reproduce

This is a kotlin file with asciidoc references: https://github.com/jdbi/jdbi/blob/master/docs/src/test/kotlin/jdbi/doc/KotlinPluginTest.kt

Running it through "ktlint --experimental` results in:

/Users/henning/code/jdbi/docs/src/test/kotlin/jdbi/doc/KotlinPluginTest.kt:79:5: Declarations and declarations with annotations should have an empty space between.
/Users/henning/code/jdbi/docs/src/test/kotlin/jdbi/doc/KotlinPluginTest.kt:88:5: Declarations and declarations with annotations should have an empty space between.

It is not clear to my why this is reported. It seems that ktlint is trying to parse the contents of the line comments (which are used by asciidoc to reference part of the source code in the documentation).

Your Environment

  • Version of ktlint used: maven-plugin 1.11.0, using ktlint 0.43

  • Maven 3.8.3

  • Java version: 17.0.1, vendor: Homebrew, runtime: /usr/local/Cellar/openjdk/17.0.1/libexec/openjdk.jdk/Contents/Home

  • Default locale: en_US, platform encoding: UTF-8

  • OS name: "mac os x", version: "11.6.1", arch: "x86_64", family: "mac"

  • Link to your project (if it's a public repository): https://github.com/jdbi/jdbi/

paul-dingemans pushed a commit to paul-dingemans/ktlint that referenced this issue Nov 27, 2021
A block of comments including at least one blank line between two annotated
declarations was not recognized as having the required spacing.

 Closes pinterest#1281
paul-dingemans pushed a commit to paul-dingemans/ktlint that referenced this issue Nov 27, 2021
shashachu pushed a commit that referenced this issue Nov 30, 2021
* Remove unused variables

* Fix false positive in spacing-between-declarations-with-annotations

A block of comments including at least one blank line between two annotated
declarations was not recognized as having the required spacing.

 Closes #1281

* Fix false positive in spacing-between-declarations-with-annotations (update changelog)

Closes #1281

Co-authored-by: Paul Dingemans <pdingemans@bol.com>
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