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

[java] Improve comments prettyPrinting #20

Merged
merged 3 commits into from
May 25, 2023

Conversation

blacelle
Copy link
Contributor

@blacelle blacelle commented Apr 2, 2023

This follows the work from cucumber/common#2024 (Thanks @jamietanna ).

It proposes improvments for comments rendering. This is not perfect, but looks better than current behavior (especially over comments after a @Tag, Scenario, etc).

@blacelle blacelle changed the title Improve comments [java] Improve comments prettyPrinting Apr 2, 2023
@blacelle
Copy link
Contributor Author

blacelle commented Apr 2, 2023

This is contextual to the integration of this library into Spotless diffplug/spotless#1649

nedtwigg added a commit to blacelle/spotless that referenced this pull request Apr 5, 2023
@xeger
Copy link
Member

xeger commented May 6, 2023

Just a quick note @blacelle that I'm working on a related PR for javascript/ and I've recently restored a bunch of *.feature test fixtures that the JS unit tests employ. These files existed in the monorepo, and got missed when gherkin-utils was moved into its own repo. They may be relevant to your PR.

@blacelle
Copy link
Contributor Author

blacelle commented May 6, 2023

Thanks @xeger . This PR is ready since a month, but it seems there is no maintainer to review it.

@blacelle
Copy link
Contributor Author

blacelle commented May 6, 2023

@mpkorstanje As you reviewed #16, please have a look to this PR. Thanks

@Test
void commentsBeforeAndAfterKeywords(){
GherkinDocument gherkinDocument = parse("# before Feature\n" +
"Feature: Comments everywhere\n" +
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if it would be useful to harmonize our test cases between languages. How this might look:

  1. new directory testdata/pretty/before and testdata/pretty/after
  2. @blacelle move our examples into before/foo.feature and after/foo.feature
  3. we read these files from disk in our JS/Java test code, and both suites execute all examples

The benefit is, we ensure that both languages have identical treatment of comments when prettying. I am not sure how important this behavior is.

If interested, I can get this started on #16.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The benefit is, we ensure that both languages have identical treatment of comments when prettying. I am not sure how important this behavior is.

This would definitely be a good thing.


I would be happy to follow this structure, preferable in a separate PR. But I do not get how to contribute to this repository as this PR seems stuck :S.

Copy link
Member

@xeger xeger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. The JS implementation has gotten out of sync with these improvements, but we can achieve parity once we have a shared body of testdata files to help us correlate between the languages' behavior.

@blacelle
Copy link
Contributor Author

@xeger @aslakhellesoy How can I move forward with this PR?

@xeger xeger merged commit 6a18628 into cucumber:main May 25, 2023
@aslakhellesoy
Copy link
Contributor

Hi @blacelle,

Thanks for your making your first contribution to Cucumber, and welcome to the Cucumber committers team! You can now push directly to this repo and all other repos under the cucumber organization! 🍾

In return for this generous offer we hope you will:

  • ✅ Continue to use branches and pull requests. When someone on the core team approves a pull request (yours or someone else's), you're welcome to merge it yourself.
  • 💚 Commit to setting a good example by following and upholding our code of conduct in your interactions with other collaborators and users.
  • 💬 Join the community Slack channel to meet the rest of the team and make yourself at home.
  • ℹ️ Don't feel obliged to help, just do what you can if you have the time and the energy.
  • 🙋 Ask if you need anything. We're looking for feedback about how to make the project more welcoming, so please tell us!

On behalf of the Cucumber core team,
Aslak Hellesøy
Creator of Cucumber

@blacelle blacelle deleted the improveComments branch May 25, 2023 14:37
@blacelle
Copy link
Contributor Author

Thanks a lot @xeger

@xeger
Copy link
Member

xeger commented May 25, 2023

Thank you for your contribution. I'll work on releasing a new JAR over the weekend.

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 this pull request may close these issues.

3 participants