Skip to content

Commit 694eea7

Browse files
committed
Introduce gherkin linter
1 parent bb503d9 commit 694eea7

File tree

2 files changed

+55
-0
lines changed

2 files changed

+55
-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: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,29 @@ 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: Check existence of .gherkin-lintrc file
84+
id: check_gherkin_lintrc_file
85+
uses: andstor/file-existence-action@v3
86+
with:
87+
files: ".gherkin-lintrc"
88+
89+
- name: Download lint rules
90+
if: steps.check_gherkin_lintrc_file.outputs.files_exists == 'false'
91+
run: curl https://gist.githubusercontent.com/ernilambar/a7a30af6f6f6bd5be238d5499993233a/raw/3b8f54e2d36be33706947ce6ce44c5a888cee464/gherkin-lintrc.json -o .gherkin-lintrc
92+
93+
- name: Run linter
94+
run: npx --yes gherkin-lint
95+
7396
phpcs: #----------------------------------------------------------------------
7497
name: PHPCS
7598
runs-on: ubuntu-latest

0 commit comments

Comments
 (0)