cucumber / gherkin-utils

API for working with Gherkin documents
MIT License
9 stars 4 forks source link

trailing whitespace added after Background: in each feature file #24

Closed Jiehong closed 1 year ago

Jiehong commented 1 year ago

Creating this bug report, because I'm not sure if it's link to spotless or this plugin.

Spotless issue is: https://github.com/diffplug/spotless/issues/1693

Jiehong commented 1 year ago

issue is confirmed to come from this repository: when running mvn spotless:apply, this plugin is adding a trailing whitespace:

Creating a feature file with the following content:

Feature: my_feature

  Background:
    def thing = "hello"

and running mvn spotless:check will generate the following error:

[ERROR] Failed to execute goal com.diffplug.spotless:spotless-maven-plugin:2.36.0:check (default-cli) on project maestro_server_qa_karate: The following files had format violations:
[ERROR]     src\test\java\my_feature.feature
[ERROR]         @@ -1,6 +1,6 @@
[ERROR]          Feature:·my_feature
[ERROR]
[ERROR]         -··Background:
[ERROR]         +··Background:·
[ERROR]          ····*·def·thing·=·"hello"

Note the trailing space added after Background:.

mpkorstanje commented 1 year ago

The code here naively assumes that all backgrounds, (and presumably all scenarios and examples too) have a name. Happy to take a pull requests that updates the tests and fixes this.

https://github.com/cucumber/gherkin-utils/blob/69035dc6eb4386d6ae27cf6d8aa754883651fc23/java/src/main/java/io/cucumber/gherkin/utils/pretty/PrettyHandlers.java#LL224C1-L230C6

blacelle commented 1 year ago

Given https://github.com/cucumber/gherkin-utils/pull/20#event-9340877116 is now merged, I can be a bit more active in this repo. Still happy to taker over this @mpkorstanje? Else I'll handle it.

mpkorstanje commented 1 year ago

Please do pick it up!

blacelle commented 1 year ago

The PR is ready

Jiehong commented 1 year ago

thank you!