You are reading the documentation for gurkencheck 0.0.4. Go to the latest version.

gurkencheck A linter for Gherkin feature files.

indentation

Checks how far each line is indented.

What it does

Even indentation makes a feature file readable at a glance. You can set a number for each kind of line. Anything you leave out keeps its default. Tags follow the node they sit above, and a doc string follows its step, one level further in. Set character to space or tab if your team keeps mixing the two.

Turning it on

Add this to your .gurkencheckrc:

{
  "indentation": ["on", {
    "Feature": 0,
    "Scenario": 2,
    "Step": 4
  }]
}

Settings

SettingValueIf you leave it outWhat it does
Feature number of spaces 0 Indentation of the Feature line.
Rule number of spaces 0 Indentation of a Rule line.
Background number of spaces 0 Indentation of a Background line.
Scenario number of spaces 0 Indentation of a Scenario or Scenario Outline line.
Step number of spaces 2 Indentation of every step, unless you set that keyword on its own.
Examples number of spaces 0 Indentation of an Examples line.
example number of spaces 2 Indentation of each row in an Examples table.
given number of spaces the Step setting Indentation of Given steps only.
when number of spaces the Step setting Indentation of When steps only.
then number of spaces the Step setting Indentation of Then steps only.
and number of spaces the Step setting Indentation of And steps only.
but number of spaces the Step setting Indentation of But steps only.
feature tag number of spaces the Feature setting Indentation of tags above the Feature.
rule tag number of spaces the Rule setting Indentation of tags above a Rule.
scenario tag number of spaces the Scenario setting Indentation of tags above a Scenario.
docstring number of spaces the Step setting plus 2 Indentation of the """ or ``` line that opens a doc string under a step.
character one of any, space or tab any Which character indentation has to be made of. Leave it at any to accept either.

Examples

Passes
Feature: Logging in

  Scenario: A known user logs in
    Given I am a known user
    When I log in
    Then I see my dashboard
Fails
Feature: Logging in

      Scenario: A known user logs in
  Given I am a known user
    When I log in
    Then I see my dashboard

gurkencheck reports: Wrong indentation for "Scenario", expected indentation level of 2, but got 6