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

Add linting for Behat feature files #172

Open
danielbachhuber opened this issue Aug 24, 2023 · 3 comments
Open

Add linting for Behat feature files #172

danielbachhuber opened this issue Aug 24, 2023 · 3 comments

Comments

@danielbachhuber
Copy link
Member

To ensure consistent formatting of the feature files, it would be nice to add a linter.

https://github.com/j13k/yaml-lint looks like a good candidate.

Related j13k/yaml-lint#81

Done is:

  • Behat feature file linting is applied across all repositories.
@ernilambar
Copy link
Member

It seems we have already implemented Gherkin Linter in scaffold package command https://github.com/wp-cli/scaffold-package-command/blob/main/package.json#L8

@ernilambar
Copy link
Member

I was testing the linter. Here is one example.

name: Gherkin Linting

on:
  pull_request:
    branches:
      - main
      - master
  workflow_dispatch:
  workflow_call:

jobs:

  gherkin-lint:
    name: Lint Gherkin Feature files
    runs-on: ubuntu-latest
    steps:
      - name: Check out source code
        uses: actions/checkout@v4

      - name: Setup node
        uses: actions/setup-node@v4

      - name: Download lint rules
        run: curl https://gist.githubusercontent.com/ernilambar/a7a30af6f6f6bd5be238d5499993233a/raw/3b8f54e2d36be33706947ce6ce44c5a888cee464/gherkin-lintrc.json -o .gherkin-lintrc

      - name: Run lint
        run: npx --yes gherkin-lint

We could keep Gherkin lint rule file in our central repo. Currently I have pulled from my Gist.

@ernilambar
Copy link
Member

I have drafted a PR here - wp-cli/core-command#268

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