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

Improve formatting in Feature and Scenario descriptions #154

Closed
andrewesweet opened this issue May 12, 2020 · 5 comments
Closed

Improve formatting in Feature and Scenario descriptions #154

andrewesweet opened this issue May 12, 2020 · 5 comments
Milestone

Comments

@andrewesweet
Copy link
Contributor

andrewesweet commented May 12, 2020

Cukedoctor currently passes along a Feature or Scenario description's leading whitespace to AsciiDoc, except the first line. She problem is that whitespace is often formatting the feature file rather than desired indentation of the description paragraph block in AsciiDoc. e.g. My features are indented one tab, so their descriptions are two tabs; my scenarios are indented two tabs, so their descriptions are indented three tabs etc..

I think Cukedoctor should look at the indentation of the first non-blank line of a description and trim however many character of leading whitespace are in that line off all other lines i.e. treat leading whitespace in the first line as formatting the feature file and any subsequent additional leading whitespace on other lines as formatting the description block.

E.g.

    This is the description for Feature One. The first non-blank line of this description in the feature file began with four whitespace characters.
      Therefore, cukedoctor will ignore up to the first four
whitespace characters
  in all other lines in the same description,
    if any are present.


This includes
  further lines
    in a different
      paragraph
        in the same description.

should be rendered as

This is the description for Feature One. The first non-blank line of this description in the feature file began with four whitespace characters.
  Therefore, cukedoctor will ignore up to the first four
whitespace characters
in all other lines in the same description,
if any are present.


This includes
further lines
in a different
  paragraph
    in the same description. 

as opposed to the current

This is the description for Feature One. The first non-blank line of this description in the feature file began with four whitespace characters.
      Therefore, cukedoctor will ignore up to the first four
whitespace characters
  in all other lines in the same description,
    if any are present.


This includes
  further lines
    in a different
      paragraph
        in the same description.
@rmpestano
Copy link
Owner

Hi @andrewesweet, why your feature files has such formating? isn't it easier to adjust the feature description instead of trying to fix that in Cukedoctor?

Also for your PR #155, please rebase your branch with cukedoctor master branch or create a new branch on top of master and add your changes on this branch. It will be easier to review your changes.

@andrewesweet
Copy link
Contributor Author

Sorry - I missed the lack of rebase, although the PR makes it obvious. Will fix.

Regarding the formatting, the style shown in the Gherkin online reference and in the most commonly used IntelliJ plugin for Cucumber JVM both use indentation of Scenarios under features and align the descriptions accordingly.

@rmpestano
Copy link
Owner

I've rebased master commits into your branch otherwise we would not be able to merge your PR because the repositories trees were different.

Let's wait CI build and then merge the PR, thank you very much!

@rmpestano rmpestano added this to the 2.1.1 milestone May 16, 2020
@rmpestano rmpestano changed the title Leading whitespace in Feature and Scenario descriptions Improve formatting in Feature and Scenario descriptions May 16, 2020
@rmpestano rmpestano modified the milestones: 2.1.1, 3.1 May 16, 2020
@rmpestano
Copy link
Owner

The fix for this is available in v3.1. Thank you @andrewesweet!

@andrewesweet
Copy link
Contributor Author

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants