gherkin-lint
gherkin-lint documentation
- Visit Official Web Site
- See How to configure gherkin-lint rules
- If custom
.gherkin-lintrc
config file isn't found, .gherkin-lintrc will be used
- If custom
- See Index of problems detected by gherkin-lint
Configuration in MegaLinter
- Enable gherkin-lint by adding
GHERKIN_GHERKIN_LINT
in ENABLE_LINTERS variable - Disable gherkin-lint by adding
GHERKIN_GHERKIN_LINT
in DISABLE_LINTERS variable
Variable | Description | Default value |
---|---|---|
GHERKIN_GHERKIN_LINT_ARGUMENTS | User custom arguments to add in linter CLI call Ex: -s --foo "bar" |
|
GHERKIN_GHERKIN_LINT_FILTER_REGEX_INCLUDE | Custom regex including filter Ex: (src\|lib) |
Include every file |
GHERKIN_GHERKIN_LINT_FILTER_REGEX_EXCLUDE | Custom regex excluding filter Ex: (test\|examples) |
Exclude no file |
GHERKIN_GHERKIN_LINT_CLI_LINT_MODE | Override default CLI lint mode - file : Calls the linter for each file- project : Call the linter from the root of the project |
file |
GHERKIN_GHERKIN_LINT_FILE_EXTENSIONS | Allowed file extensions. "*" matches any extension, "" matches empty extension. Empty list excludes all filesEx: [".py", ""] |
[".feature"] |
GHERKIN_GHERKIN_LINT_FILE_NAMES_REGEX | File name regex filters. Regular expression list for filtering files by their base names using regex full match. Empty list includes all files Ex: ["Dockerfile(-.+)?", "Jenkinsfile"] |
Include every file |
GHERKIN_GHERKIN_LINT_PRE_COMMANDS | List of bash commands to run before the linter | None |
GHERKIN_GHERKIN_LINT_POST_COMMANDS | List of bash commands to run after the linter | None |
GHERKIN_GHERKIN_LINT_UNSECURED_ENV_VARIABLES | List of env variables explicitly not filtered before calling GHERKIN_GHERKIN_LINT and its pre/post commands | None |
GHERKIN_GHERKIN_LINT_CONFIG_FILE | gherkin-lint configuration file nameUse LINTER_DEFAULT to let the linter find it |
.gherkin-lintrc |
GHERKIN_GHERKIN_LINT_RULES_PATH | Path where to find linter configuration file | Workspace folder, then MegaLinter default rules |
GHERKIN_GHERKIN_LINT_DISABLE_ERRORS | Run linter but consider errors as warnings | false |
GHERKIN_GHERKIN_LINT_DISABLE_ERRORS_IF_LESS_THAN | Maximum number of errors allowed | 0 |
GHERKIN_GHERKIN_LINT_CLI_EXECUTABLE | Override CLI executable | ['gherkin-lint'] |
MegaLinter Flavours
This linter is available in the following flavours
Flavor | Description | Embedded linters | Info | |
---|---|---|---|---|
all | Default MegaLinter Flavor | 113 | ||
dotnet | Optimized for C, C++, C# or VB based projects | 59 |
Behind the scenes
How are identified applicable files
- File extensions:
.feature
How the linting is performed
- gherkin-lint is called one time by identified file (
file
CLI lint mode)
Example calls
gherkin-lint myfile.feature
gherkin-lint -c .gherkin-lintrc myfile.feature
Help content
Usage: gherkin-lint [options] <feature-files>
Options:
-f, --format [format] output format. Possible values: json, stylish, xunit.
Defaults to stylish
-i, --ignore <...> comma seperated list of files/glob patterns that the
linter should ignore, overrides .gherkin-lintignore
file
-c, --config [config] configuration file, defaults to .gherkin-lintrc
-r, --rulesdir <...> additional rule directories (default: [])
-h, --help display help for command
Installation on mega-linter Docker image
- NPM packages (node.js):