Skip to content

Commit f8731f8

Browse files
committed
Introduce Gherkin linter
1 parent bb503d9 commit f8731f8

File tree

2 files changed

+48
-0
lines changed

2 files changed

+48
-0
lines changed

.gherkin-lintrc

Lines changed: 32 additions & 0 deletions
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+
}

.github/workflows/reusable-code-quality.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,22 @@ jobs:
7070
if: steps.check_linter_file.outputs.files_exists == 'true'
7171
run: vendor/bin/parallel-lint -j 10 . --show-deprecated --exclude vendor --exclude .git --checkstyle | cs2pr
7272

73+
lint-gherkin: #----------------------------------------------------------------
74+
name: Lint Gherkin Feature files
75+
runs-on: ubuntu-latest
76+
steps:
77+
- name: Check out source code
78+
uses: actions/checkout@v4
79+
80+
- name: Setup node
81+
uses: actions/setup-node@v4
82+
83+
- name: Download lint rules
84+
run: curl https://raw.githubusercontent.com/wp-cli/.github/refs/heads/main/.gherkin-lintrc -o $RUNNER_TEMP/.gherkin-lintrc
85+
86+
- name: Run linter
87+
run: npx --yes gherkin-lint -c $RUNNER_TEMP/.gherkin-lintrc
88+
7389
phpcs: #----------------------------------------------------------------------
7490
name: PHPCS
7591
runs-on: ubuntu-latest

0 commit comments

Comments
 (0)