Open danielbachhuber opened 1 year ago
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
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.
I have drafted a PR here - https://github.com/wp-cli/core-command/pull/268
As per my comment on that PR, this would be a nice addition especially when leveraging problem matchers to enable annotations
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 https://github.com/j13k/yaml-lint/issues/81
Done is: