Rules
All 41 of them. Each page shows what the rule does, how to switch it on, what you can set, and an example that passes next to one that fails.
Rules you switch on#
Off unless a configuration file names them, or unless you are using the recommended set.
-
allowed-tagsOnly lets you use tags from a list you decide on.
-
background-setup-onlyKeeps a Background to setting things up.
-
file-nameKeeps every feature file named in the same style.
-
indentationChecks how far each line is indented.
-
keywords-in-logical-orderKeeps Given, When and Then in that order.
-
max-scenarios-per-fileLimits how many scenarios one file may hold.
-
name-lengthStops names and steps from growing too long.
-
new-line-at-eofRequires, or forbids, an empty line at the end of the file.
-
no-background-only-scenarioDrops a Background that only one scenario uses.
-
no-dupe-feature-namesMakes sure no two features share a name.
-
no-dupe-file-namesNo two feature files may share a name.
-
no-dupe-scenario-namesMakes sure no two scenarios share a name.
-
no-duplicate-tagsStops the same tag being written twice in one place.
-
no-empty-backgroundRemoves a Background with no steps in it.
-
no-empty-fileFlags feature files with nothing in them.
-
no-examples-in-scenariosReminds you that Examples belong to a Scenario Outline.
-
no-files-without-scenariosFlags a feature file that never tests anything.
-
no-homogenous-tagsMoves a tag up when every scenario carries it.
-
no-multiple-empty-linesLimits how many blank lines may sit next to each other.
-
no-partially-commented-tag-linesCatches a "#" part way along a line of tags.
-
no-restricted-patternsBans wording you do not want in your feature files.
-
no-restricted-tagsBans tags you do not want committed.
-
no-scenario-outlines-without-examplesFlags a Scenario Outline with no rows to run.
-
no-scenarios-without-thenEvery scenario has to check something.
-
no-scenarios-without-whenEvery scenario has to do something.
-
no-superfluous-tagsRemoves a tag repeated from the level above.
-
no-trailing-spacesRemoves spaces and tabs left at the end of a line.
-
no-unnamed-featuresEvery Feature needs a name.
-
no-unnamed-scenariosEvery Scenario needs a name.
-
no-unused-variablesEvery column of an Examples table should be used by a step.
-
no-undeclared-variablesEvery <placeholder> in a step needs a column to fill it in.
-
one-space-between-tagsOne space between tags on the same line.
-
only-one-whenOne action per scenario.
-
required-tagsRequires each scenario to carry certain tags.
-
scenario-sizeLimits how many steps a scenario or background may have.
-
use-andUse And instead of repeating a keyword.
Always on#
These describe things Gherkin itself refuses to read, so a file that breaks one of them cannot be checked at all.
-
no-tags-on-backgroundsA Background cannot have tags.
-
one-feature-per-fileOne Feature per file.
-
up-to-one-background-per-fileAt most one Background per file.
-
background-before-scenariosA Background has to come before the Scenarios it applies to.
-
no-multiline-stepsA step has to fit on one line.