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

Diff and check command line formatting #76

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft

Conversation

kieran-ryan
Copy link
Sponsor Member

@kieran-ryan kieran-ryan commented Apr 14, 2024

πŸ€” What's changed?

  • Exit code 1 if files reformatted or would be reformatted
  • --check option to check whether reformatting would occur without writing changes
  • --diff option to check whether reformatting would occur without writing changes; and output diff
  • Support formatting against directories
  • Counts for failures, unchanged and formatted files
> npx @cucumber/gherkin-utils format features
❌ 7 files failed to format
πŸ₯’ 14 files left unchanged
πŸ₯’ 25 files reformatted

Debt

  • Prevent writing back to file if no changes to be made
  • Updated issues URL in parser error message from common repo to gherkin parser
  • Migrated from deprecated commander-js API to specify argument descriptions in .description rather .argument
  • Updated README from outdated --move API to --to-syntax

⚑️ What's your motivation?

  • Enables increased proliferation of Gherkin Utils across repositories containing feature files - for validating formatting in continous integration pipelines
  • Simplifies usage to run Gherkin Utils against directories containing feature files
  • Enables checking would formatting occur without writing changes
  • Counts provides much greater clarity on changes

Debt

  • Eliminate redundant write operations
  • Ensure parse error messages raised to correct repository
  • Ensure commander-js using latest APIs
  • Align docs with latest API

🏷️ What kind of change is this?

  • ⚑ New feature (non-breaking change which adds new behaviour)

♻️ Anything particular you want feedback on?

  • Whether should default formatter to run against a features directory (e.g. npx @cucumber/gherkin-utils format) to simplify common usage
  • Whether can remove --from-syntax command line option. Not sure is required as syntax (gherkin or markdown) can be determined

πŸ“‹ Checklist:

  • I agree to respect and uphold the Cucumber Community Code of Conduct
  • I've changed the behaviour of the code
    • I have added/updated tests to cover my changes.
  • My change requires a change to the documentation.
    • I have updated the documentation accordingly.
  • Users should know about my change
    • I have added an entry to the "Unreleased" section of the CHANGELOG, linking to this pull request.

This text was originally generated from a template, then edited by hand. You can modify the template here.

@kieran-ryan kieran-ryan added the ⚑ enhancement Request for new functionality label Apr 14, 2024
@kieran-ryan kieran-ryan self-assigned this Apr 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
⚑ enhancement Request for new functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant