Skip to content

Commit

Permalink
Merge pull request #754 from WordPress/implement-gherkin-linter
Browse files Browse the repository at this point in the history
Implement gherkin linter in GH action
  • Loading branch information
ernilambar authored Oct 27, 2024
2 parents cf7bfa5 + 58d971a commit 02aeb3e
Show file tree
Hide file tree
Showing 8 changed files with 598 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .distignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ tests
.distignore
.editorconfig
.eslintrc.js
.gherkin-lintignore
.gherkin-lintrc
.gitattributes
.gitignore
.nvmrc
Expand Down
2 changes: 2 additions & 0 deletions .gherkin-lintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules/**
vendor/**
32 changes: 32 additions & 0 deletions .gherkin-lintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"file-name": [
"on",
{
"style": "kebab-case"
}
],
"indentation": [
"on",
{
"Feature": 0,
"Background": 2,
"Scenario": 2,
"Examples": 4,
"Step": 4,
"given": 4,
"example": 6,
"and": 4
}
],
"no-dupe-feature-names": "on",
"no-dupe-scenario-names": "off",
"no-empty-file": "on",
"no-files-without-scenarios": "on",
"no-multiple-empty-lines": "on",
"no-partially-commented-tag-lines": "on",
"no-trailing-spaces": "on",
"no-unnamed-features": "on",
"no-unnamed-scenarios": "on",
"no-scenario-outlines-without-examples": "on",
"use-and": "on"
}
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@

/.editorconfig export-ignore
/.eslintrc.js export-ignore
/.gherkin-lintignore export-ignore
/.gherkin-lintrc export-ignore
/.nvmrc export-ignore
/.wp-env.json export-ignore
/composer.lock export-ignore
Expand Down
46 changes: 46 additions & 0 deletions .github/workflows/gherkin-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Gherkin Linting

on:
push:
branches:
- trunk
- 'release/**'
# Only run if feature files are changed.
paths:
- '.github/workflows/gherkin-lint.yml'
- 'package-lock.json'
- '**.feature'
pull_request:
branches:
- trunk
- 'release/**'
- 'feature/**'
# Only run if feature files are changed.
paths:
- '.github/workflows/gherkin-lint.yml'
- 'package-lock.json'
- '**.feature'
types:
- opened
- reopened
- synchronize

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
with:
node-version-file: '.nvmrc'
cache: npm

- name: Install dependencies
run: npm ci

- name: Gherkin lint
run: npm run lint-gherkin
Loading

0 comments on commit 02aeb3e

Please sign in to comment.