- allowed-tags: Only permit specified tags
- filename: Filenames must conform to the specified stype
- indentation: Ensure consistent indentation
- keyword-order: Ensure that keywords are in the correct order
- no-background-with-single-scenario: Backgrounds are only allowed when there is more than one scenario
- no-consecutive-empty-lines: Do not permit consecutive empty lines
- no-restricted-patterns: Dissallow text matching any of the given patterns
- no-duplicate-tags: Disallow duplicate tags
- no-duplicated-feature-names: Dissallow duplicated feature names
- no-duplicated-scenario-names: Dissallow duplicated scenarios within feature files
- no-empty-background: Disallow empty backgrounds
- no-empty-file: Disallow empty files
- no-empty-scenarios: Disallow empty scenarios
- no-homogenous-tags: If a tag exists on each scenarion then it should be moved to the feature level
- no-superflous-tags: Do not repeat tags in scenarios that are already present at the feature level
- no-trailing-spaces: Do not allow extra spaces at the end of lines
- no-unnamed-features: Do not allow Feature declarations with no name
- one-space-between-tags: Only allow one space between tags
- scenario-size: Limit the number of steps in a scenario
- scenarios-per-file: Set a maximum (and/or minimum) number of scenarios allowed per file
Only permit specified tags
Good: Feature has allowed tags
{
"allowed-tags": {
"allow": [
"@foo",
"@bar"
]
}
}
# example.feature
@foo @bar
Feature: Some feature
Bad: Feature has not allowed tags
{
"allowed-tags": {
"allow": [
"@baz"
]
}
}
# example.feature
@this-is-not-allowed
Feature: Some feature
Filenames must conform to the specified stype
Good: Snake case
{
"filename": {
"style": "snake_case"
}
}
# this_is_fine.feature
Feature: Some feature
Good: Pascal case
{
"filename": {
"style": "PascalCase"
}
}
# ThisIsFine.feature
Feature: Some feature
Good: Kebab Case
{
"filename": {
"style": "kebab-case"
}
}
# this-is-fine.feature
Feature: Some feature
Good: Camel case
{
"filename": {
"style": "camelCase"
}
}
# thisIsFine.feature
Feature: Some feature
Ensure consistent indentation
Good: Valid indentation
{
"indentation": {
"width": 4,
"feature": 0,
"rule": 1,
"backgroud": 1,
"scenario": 1,
"step": 2,
"table": 3,
"literalBlock": 2,
"examples": 2,
"examplesTable": 3
}
}
# example.feature
Feature: Foobar
Scenario: This is a scenario
Given this is a scenario
And the indentation is correct
When I run the linter
Then it should be fine
Bad: Invalid indentation
{
"indentation": {
"width": 4,
"feature": 0,
"rule": 1,
"backgroud": 1,
"scenario": 1,
"step": 2,
"table": 3,
"literalBlock": 2,
"examples": 2,
"examplesTable": 3
}
}
# example.feature
Feature: Foobar
Scenario: This is a scenario
Given this is a scenario
And the indentation is incorrect
When I run the linter
Then things will not be good
Ensure that keywords are in the correct order
Good: Keywords in correct order
# example.feature
Feature: Foobar
Scenario: This is a scenario
Given this is a scenario
And the indentation is incorrect
When I run the linter
Then things will not be good
Bad: Extra when is not allowed
# example.feature
Feature: Foobar
Scenario: This is a scenario
Given this is a scenario
And the indentation is incorrect
When I run the linter
Then things will not be good
When I do something else
Bad: Scenarios cannot start with Then
# example.feature
Feature: Foobar
Scenario: This is a scenario
Then things will not be good
Bad: Scenarios cannot start with And
# example.feature
Feature: Foobar
Scenario: This is a scenario
And things will not be good
Good: Tolerate then before when with config option
{
"keyword-order": {
"tolerateThenBeforeWhen": true
}
}
# example.feature
Feature: Foobar
Scenario: This is a scenario
Given something
Then an exception should be thrown
When I do this
Backgrounds are only allowed when there is more than one scenario
Good: Background with more than one scenario
# example.feature
Feature: Foobar
Background:
Given I have stuff
Scenario: One
Scenario: Two
Bad: Background with one scenario
# example.feature
Feature: Foobar
Background:
Given I have stuff
Scenario: One
Do not permit consecutive empty lines
Good: No consecutive empty lines
# example.feature
Feature: Foo
Scenario: One
Scenario: Two
Scenario: Three
Bad: Consecutive empty lines
# example.feature
Feature: Foo
Scenario: One
Scenario: Two
Scenario: Three
Dissallow text matching any of the given patterns
Bad: Disallow the term "Client"
{
"no-restricted-patterns": {
"patterns": [
"\/client\/i"
]
}
}
# example.feature
Feature: Client
Disallow duplicate tags
Good: No duplicate tags
# example.feature
@foo @bar
Feature: Some feature
Bad: Duplicated tags
# example.feature
@foo @foo
Feature: Some feature
Dissallow duplicated feature names
Good: Feature with unique title
# example.feature
Feature: this feature title is one of a kind
Dissallow duplicated scenarios within feature files
Good: No duplicated scenarios
# example.feature
Feature: Foobar
Scenario: One
Scenario: Two
Bad: Duplicated scenarios
# example.feature
Feature: Foobar
Scenario: One
Scenario: One
Disallow empty backgrounds
Good: Non-empty background
# example.feature
Feature: Foobar
Background:
Given something happened
Bad: Empty background
# example.feature
Feature: Foobar
Background:
Disallow empty files
Good: Non-empty file
# example.feature
Feature: Foobar
Bad: Empty file
# example.feature
Disallow empty scenarios
Bad: Scenarios that are empty
# example.feature
Feature: Example
Scenario: One
Scenario: Two
Good: Scenarios that are not empty
# example.feature
Feature: Example
Scenario: One
When I do this
Then this should happen
Scenario: Two
When I do this
Then this should happen
If a tag exists on each scenarion then it should be moved to the feature level
Good: No tags are present on all scenarios
# example.feature
Feature: Good feature
@one
Scenario: One
@two
Scenario: Two
@three
Scenario: Three
Bad: One tag is present in all scenarios
# example.feature
Feature: Bad feature
@one
Scenario: One
@two @one
Scenario: Two
@three @one
Scenario: Three
Do not repeat tags in scenarios that are already present at the feature level
Good: No superflous tags
# example.feature
@important
Feature: Foobar
@this-there @is @no-waste
Scenario: No waste
Bad: Tag that is repeated in the Feature
# example.feature
@important
Feature: Foobar
@this-there @is @no-waste @important
Scenario: No waste
Do not allow extra spaces at the end of lines
Good: No trailing spaces
# example.feature
Feature: Foobar
There are no trailing spaces on this line
Bad: Trailing spaces
# example.feature
Feature: Foobar
There are trailing spaces on this line
Bad: Trailing spaces
# example.feature
Feature: Foobar
There are trailing spaces above
Do not allow Feature declarations with no name
Good: Feature with a name
# example.feature
Feature: This feature has a name!
Bad: Feature with no name
# example.feature
Feature:
Only allow one space between tags
Good: Tags have one space between them
# example.feature
@tag1 @tag2 @tag3
Feature: Foobar
@tag4 @tag5
Scenario: Barfoo
Good: Tags have one space between them
# example.feature
@tag1
@tag2
@tag3
Feature: Foobar
Bad: Tags have more than one space between them
# example.feature
@tag1 @tag2 @tag3
Feature: Foobar
Bad: Tags have more than one space between them
# example.feature
Feature: Foobar
@tag1 @tag2
Scenario: Barfoo
Limit the number of steps in a scenario
Good: Valid number of steps
# example.feature
Feature: This is feature
Scenario: This is scenario
Given I did this
When I do that
Then this should happen
Bad: Too many steps!
{
"scenario-size": {
"maxSteps": 3
}
}
# example.feature
Feature: This is feature
Scenario: This is scenario
Given I did this
And that
And something else
When I do that
Then this should happen
Set a maximum (and/or minimum) number of scenarios allowed per file
Good: Valid quantity of scenarios
{
"scenarios-per-file": {
"min": 1,
"max": 3
}
}
# example.feature
Feature: One
Scenario: One
Scenario: Two
Scenario: Three
Bad: Too many scenarios
{
"scenarios-per-file": {
"min": 0,
"max": 1
}
}
# example.feature
Feature: One
Scenario: First scenario
Scenario: Two
Bad: Not enough scenarios
{
"scenarios-per-file": {
"min": 5,
"max": 10
}
}
# example.feature
Feature: One
Scenario: One