Skip to content

Trailing spaces not removed in multiline comment block #1197

@mhernand40

Description

@mhernand40

Adding · to the code snippet to visually represent spaces. Let's say we have the following code:

/*·
·*·©·Your·Copyright·Here
·*/

package·com.foo

class·Foo

Expected Behavior

Ktlint should be able to flag and remove that trailing space on line 1.

Observed Behavior

The trailing space remains, Ktlint does not complain about it nor does it strip it when running the formatter.

Steps to Reproduce

  1. Paste the above code in a basic text editor (IDE may auto format if you paste it there and save)
  2. Run Ktlint against the code above.

Your Environment

  • Version of ktlint used: 0.41.0
  • Name and version (or code for custom task) of integration used (Gradle plugin, Maven plugin, command line, custom Gradle task): ./gradlew ktlintFormat
  • Version of Gradle used (if applicable):
------------------------------------------------------------
Gradle 7.1.1
------------------------------------------------------------

Build time:   2021-07-02 12:16:43 UTC
Revision:     774525a055494e0ece39f522ac7ad17498ce032c

Kotlin:       1.4.31
Groovy:       3.0.7
Ant:          Apache Ant(TM) version 1.10.9 compiled on September 27 2020
JVM:          11.0.9 (Eclipse OpenJ9 openj9-0.23.0)
OS:           Mac OS X 10.16 x86_64
  • Operating System and version: macOS Big Sur Version 11.5

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions