Skip to content

Commit 02aeb3e

Browse files
authored
Merge pull request #754 from WordPress/implement-gherkin-linter
Implement gherkin linter in GH action
2 parents cf7bfa5 + 58d971a commit 02aeb3e

8 files changed

+598
-1
lines changed

.distignore

+2
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ tests
1717
.distignore
1818
.editorconfig
1919
.eslintrc.js
20+
.gherkin-lintignore
21+
.gherkin-lintrc
2022
.gitattributes
2123
.gitignore
2224
.nvmrc

.gherkin-lintignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
node_modules/**
2+
vendor/**

.gherkin-lintrc

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{
2+
"file-name": [
3+
"on",
4+
{
5+
"style": "kebab-case"
6+
}
7+
],
8+
"indentation": [
9+
"on",
10+
{
11+
"Feature": 0,
12+
"Background": 2,
13+
"Scenario": 2,
14+
"Examples": 4,
15+
"Step": 4,
16+
"given": 4,
17+
"example": 6,
18+
"and": 4
19+
}
20+
],
21+
"no-dupe-feature-names": "on",
22+
"no-dupe-scenario-names": "off",
23+
"no-empty-file": "on",
24+
"no-files-without-scenarios": "on",
25+
"no-multiple-empty-lines": "on",
26+
"no-partially-commented-tag-lines": "on",
27+
"no-trailing-spaces": "on",
28+
"no-unnamed-features": "on",
29+
"no-unnamed-scenarios": "on",
30+
"no-scenario-outlines-without-examples": "on",
31+
"use-and": "on"
32+
}

.gitattributes

+2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212

1313
/.editorconfig export-ignore
1414
/.eslintrc.js export-ignore
15+
/.gherkin-lintignore export-ignore
16+
/.gherkin-lintrc export-ignore
1517
/.nvmrc export-ignore
1618
/.wp-env.json export-ignore
1719
/composer.lock export-ignore

.github/workflows/gherkin-lint.yml

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Gherkin Linting
2+
3+
on:
4+
push:
5+
branches:
6+
- trunk
7+
- 'release/**'
8+
# Only run if feature files are changed.
9+
paths:
10+
- '.github/workflows/gherkin-lint.yml'
11+
- 'package-lock.json'
12+
- '**.feature'
13+
pull_request:
14+
branches:
15+
- trunk
16+
- 'release/**'
17+
- 'feature/**'
18+
# Only run if feature files are changed.
19+
paths:
20+
- '.github/workflows/gherkin-lint.yml'
21+
- 'package-lock.json'
22+
- '**.feature'
23+
types:
24+
- opened
25+
- reopened
26+
- synchronize
27+
28+
jobs:
29+
gherkin-lint:
30+
name: Lint Gherkin Feature files
31+
runs-on: ubuntu-latest
32+
steps:
33+
- name: Check out source code
34+
uses: actions/checkout@v4
35+
36+
- name: Setup node
37+
uses: actions/setup-node@v4
38+
with:
39+
node-version-file: '.nvmrc'
40+
cache: npm
41+
42+
- name: Install dependencies
43+
run: npm ci
44+
45+
- name: Gherkin lint
46+
run: npm run lint-gherkin

0 commit comments

Comments
 (0)