Skip to content

gherkin-lint

GitHub stars GitHub release (latest SemVer) GitHub last commit GitHub commit activity GitHub contributors

gherkin-lint documentation

gherkin-lint - GitHub

Configuration in MegaLinter

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 files
Ex: [".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_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 Docker Image Size (tag) Docker Pulls
dotnet Optimized for C, C++, C# or VB based projects 59 Docker Image Size (tag) Docker Pulls

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