-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
331 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
end_of_line = lf | ||
indent_size = 4 | ||
insert_final_newline = true | ||
max_line_length = 160 | ||
tab_width = 4 | ||
trim_trailing_whitespace = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
{ | ||
"file-name": [ | ||
"on", | ||
{ | ||
"style": "PascalCase" | ||
} | ||
], | ||
"indentation": "on", | ||
"max-scenarios-per-file": [ | ||
"on", | ||
{ | ||
"maxScenarios": 10, | ||
"countOutlineExamples": true | ||
} | ||
], | ||
"name-length": [ | ||
"on", | ||
{ | ||
"Feature": 70, | ||
"Scenario": 70, | ||
"Step": 70 | ||
} | ||
], | ||
"new-line-at-eof": [ | ||
"on", | ||
"yes" | ||
], | ||
"no-background-only-scenario": "on", | ||
"no-dupe-feature-names": "on", | ||
"no-dupe-scenario-names": [ | ||
"on", | ||
"in-feature" | ||
], | ||
"no-duplicate-tags": "on", | ||
"no-empty-background": "on", | ||
"no-empty-file": "on", | ||
"no-examples-in-scenarios": "on", | ||
"no-files-without-scenarios": "on", | ||
"no-homogenous-tags": "on", | ||
"no-multiple-empty-lines": "on", | ||
"no-partially-commented-tag-lines": "on", | ||
"no-restricted-tags": [ | ||
"on", | ||
{ | ||
"tags": [ | ||
"@dev", | ||
"@watch", | ||
"@wip" | ||
] | ||
} | ||
], | ||
"no-scenario-outlines-without-examples": "on", | ||
"no-superfluous-tags": "on", | ||
"no-trailing-spaces": "on", | ||
"no-unnamed-features": "on", | ||
"no-unnamed-scenarios": "on", | ||
"no-unused-variables": "on", | ||
"one-space-between-tags": "on", | ||
"scenario-size": [ | ||
"on", | ||
{ | ||
"steps-length": { | ||
"Background": 15, | ||
"Scenario": 15 | ||
} | ||
} | ||
], | ||
"use-and": "on" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
name: test | ||
on: | ||
push: | ||
tags: | ||
- v* | ||
branches: | ||
- master | ||
- main | ||
pull_request: | ||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: test-default | ||
uses: ./ | ||
with: | ||
feature_files: tests/default/* | ||
|
||
- name: test-custom | ||
uses: ./ | ||
with: | ||
feature_files: tests/custom/* | ||
config_file: tests/custom/.gherkin-lintrc | ||
|
||
- name: test-ignore | ||
uses: ./ | ||
with: | ||
feature_files: tests/* | ||
ignore: tests/custom/* | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
FROM node:12-alpine | ||
|
||
RUN apk update \ | ||
&& apk --no-cache add bash | ||
|
||
COPY .gherkin-lintrc /root/ | ||
|
||
COPY run-gherkin-lint /usr/bin/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,62 @@ | ||
# gherkin-lint-action | ||
GitHub action for gherkin-lint | ||
|
||
A GitHub Action to parse feature files and run linting against the default rules, and the optional rules you specified in your `.gherkin-lintrc` file. | ||
|
||
## Usage | ||
|
||
Add `.github/workflows/lint.yml` with the following contents: | ||
|
||
```yaml | ||
name: lint | ||
on: | ||
push: | ||
tags: | ||
- v* | ||
branches: | ||
- master | ||
- main | ||
pull_request: | ||
jobs: | ||
lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: gherkin-lint | ||
uses: nhatthm/gherkin-lint-action@v1 | ||
with: | ||
# Optional: Version of gherkin-lint to use in the `npm install -g gherkin-lint` command. Default to `latest`. | ||
# version: latest | ||
|
||
# Optional: Comma separated list of feature files/glob patterns. Default to current working directory. | ||
feature_files: features/* | ||
|
||
# Optional: Use a custom configuration file instead of the default one. | ||
# config_file: .gherkin-lintrc | ||
|
||
# Optional: Output format. Possible values: json, stylish, xunit. Default to `stylish`. | ||
# format: stylish | ||
|
||
# Optional: Comma seperated list of files/glob patterns that the linter should ignore, overrides .gherkin-lintignore file | ||
# ignore: | ||
|
||
# Optional: Comma seperated list of additional rule directories | ||
# rule_dirs: | ||
``` | ||
|
||
To specify some rule you can add a configuration file `.gherkin-lintrc` into your project folder. | ||
If you don't specify anything, the [default ruleset](.gherkin-lintrc) is used. | ||
|
||
See the [list of available rules](https://github.com/vsiakka/gherkin-lint#available-rules). | ||
|
||
## Donation | ||
|
||
If this project help you reduce time to develop, you can give me a cup of coffee :) | ||
|
||
### Paypal donation | ||
|
||
[![paypal](https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif)](https://www.paypal.com/donate/?hosted_button_id=PJZSGJN57TDJY) | ||
|
||
or scan this | ||
|
||
<img src="https://user-images.githubusercontent.com/1154587/113494222-ad8cb200-94e6-11eb-9ef3-eb883ada222a.png" width="147px" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
name: 'Run gherkin-lint' | ||
description: "A GitHub Action to parse feature files and run linting using gherkin-lint" | ||
author: 'nhatthm' | ||
inputs: | ||
version: | ||
description: "Version of gherkin-lint to use in the `npm install -g gherkin-lint` command. Default to `latest`" | ||
required: false | ||
default: 'latest' | ||
feature_files: | ||
description: 'Comma separated list of feature files/glob patterns' | ||
required: false | ||
default: '.' | ||
config_file: | ||
description: 'Configuration file' | ||
required: false | ||
default: '/root/.gherkin-lintrc' | ||
format: | ||
description: 'Output format. Possible values: json, stylish, xunit. Default to `stylish`' | ||
required: false | ||
default: 'stylish' | ||
ignore: | ||
description: 'Comma seperated list of files/glob patterns that the linter should ignore, overrides .gherkin-lintignore file' | ||
required: false | ||
default: '' | ||
rule_dirs: | ||
description: 'Comma seperated list of additional rule directories' | ||
required: false | ||
default: '' | ||
runs: | ||
using: 'docker' | ||
image: 'Dockerfile' | ||
args: | ||
- "run-gherkin-lint" | ||
branding: | ||
icon: "shield" | ||
color: "yellow" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#!/usr/bin/env bash | ||
|
||
npm install -g "gherkin-lint@$INPUT_VERSION" | ||
|
||
options=() | ||
|
||
if [ -n "$INPUT_CONFIG_FILE" ]; then | ||
options+=("-c" "$INPUT_CONFIG_FILE") | ||
fi | ||
|
||
if [ -n "$INPUT_FORMAT" ]; then | ||
options+=("-f" "$INPUT_FORMAT") | ||
fi | ||
|
||
if [ -n "$INPUT_IGNORE" ]; then | ||
options+=("-i" "$INPUT_IGNORE") | ||
fi | ||
|
||
if [ -n "$INPUT_RULE_DIRS" ]; then | ||
for ruleDir in $(echo "$INPUT_RULE_DIRS" | tr ',' ' '); do | ||
options+=("-r" "$ruleDir") | ||
done | ||
fi | ||
|
||
featureFiles=($(echo "${INPUT_FEATURE_FILES:-.}" | tr ',' ' ')) | ||
|
||
echo | ||
|
||
set -ex | ||
gherkin-lint "${options[@]}" "${featureFiles[@]}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
{ | ||
"file-name": [ | ||
"on", | ||
{ | ||
"style": "PascalCase" | ||
} | ||
], | ||
"indentation": "on", | ||
"max-scenarios-per-file": [ | ||
"on", | ||
{ | ||
"maxScenarios": 10, | ||
"countOutlineExamples": true | ||
} | ||
], | ||
"name-length": [ | ||
"on", | ||
{ | ||
"Feature": 70, | ||
"Scenario": 120, | ||
"Step": 70 | ||
} | ||
], | ||
"new-line-at-eof": [ | ||
"on", | ||
"yes" | ||
], | ||
"no-background-only-scenario": "on", | ||
"no-dupe-feature-names": "on", | ||
"no-dupe-scenario-names": [ | ||
"on", | ||
"in-feature" | ||
], | ||
"no-duplicate-tags": "on", | ||
"no-empty-background": "on", | ||
"no-empty-file": "on", | ||
"no-examples-in-scenarios": "on", | ||
"no-files-without-scenarios": "on", | ||
"no-homogenous-tags": "on", | ||
"no-multiple-empty-lines": "on", | ||
"no-partially-commented-tag-lines": "on", | ||
"no-restricted-tags": [ | ||
"on", | ||
{ | ||
"tags": [ | ||
"@dev", | ||
"@watch", | ||
"@wip" | ||
] | ||
} | ||
], | ||
"no-scenario-outlines-without-examples": "on", | ||
"no-superfluous-tags": "on", | ||
"no-trailing-spaces": "on", | ||
"no-unnamed-features": "on", | ||
"no-unnamed-scenarios": "on", | ||
"no-unused-variables": "on", | ||
"one-space-between-tags": "on", | ||
"scenario-size": [ | ||
"on", | ||
{ | ||
"steps-length": { | ||
"Background": 15, | ||
"Scenario": 15 | ||
} | ||
} | ||
], | ||
"use-and": "on" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
Feature: Test for long scenario name | ||
|
||
Scenario: A scenario with a name longer than seventy characters is still valid because the custom configuration allows that | ||
Given first given within scenario, which is fine | ||
When first step | ||
And second step | ||
Then first assertion | ||
And second assertion |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
Feature: Test for the use-and rule | ||
|
||
Scenario: A scenario for use-and rule | ||
Given first given within scenario, which is fine | ||
When first step | ||
And second step | ||
Then first assertion | ||
And second assertion |