PHPackages                             kingdutch/cucumber-linter - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. kingdutch/cucumber-linter

ActiveLibrary

kingdutch/cucumber-linter
=========================

Cucumber Linter - Static analysis tool for Cucumber and Behat

0.1.6(1y ago)079.0k↑27.5%[2 issues](https://github.com/Kingdutch/cucumber-linter/issues)1MITStandard MLPHP ^8.0

Since Nov 25Pushed 1y ago1 watchersCompare

[ Source](https://github.com/Kingdutch/cucumber-linter)[ Packagist](https://packagist.org/packages/kingdutch/cucumber-linter)[ Fund](https://symfony.com/sponsor)[ GitHub Sponsors](https://github.com/fabpot)[ RSS](/packages/kingdutch-cucumber-linter/feed)WikiDiscussions 0.1.x Synced 1mo ago

READMEChangelog (7)DependenciesVersions (8)Used By (1)

Cucumber Linter - Static analysis tool for Cucumber and Behat
=============================================================

[](#cucumber-linter---static-analysis-tool-for-cucumber-and-behat)

---

Cucumber Linter focuses on providing consistent formatting for Cucumber (.feature) files.

Getting Started
---------------

[](#getting-started)

Cucumber Linter requires PHP &gt;= 8.0 to function. The linter expects your files to have the `.feature` extension.

### Installation

[](#installation)

To start linting your Cucumber/Gherkin files, require Cucumebr Linter using [Composer](https://getcomposer.org/).

```
composer require --dev kingutch/cucumber-linter
```

Composer will install Cucumber Linter’s executable in its `bin-dir` which defaults to `vendor/bin`.

You can also download the [latest PHAR](https://github.com/kingdutch/cucumber-linter/releases) and just use that.

### Running the linter

[](#running-the-linter)

To lint your test files, point the linter to the right file(s) or directory.

For example to lint your `checkout` and `login` Behat files:

```
vendor/bin/cucumber-linter tests/behat/features/capabilities/checkout tests/behat/features/capabilities/login
```

Rules enforced
--------------

[](#rules-enforced)

In this initial release the linter does not provide a way to configure which rules are running or add rules, but has a hardcoded list of rules.

Current rules are aimed at writing focused and consistent tests that clearly test a single thing. Tests should go through the three stages of `arrange`, `act`, `assert`. In the `arrange` stage pre-required existing (tested elsewhere) functionality is scaffolded. In the `act` stage we're taking some user action that triggers business logic. In the `assert` state we verify that the result of the action with the business logic has the desired result.

Scenarios should be written in such a way that the different stages of a test are easily identifyable. Additionally each stage should only occur once. A repetition of a stage suggests the test may be unfocused and should be split into multiple scenarios. Keeping scenario's focused on testing a limited scope provides stakeholders with the most information when they fail and reduces the scope of work that requires debugging to find a cause.

### Requires backgrounds to be non-empty

[](#requires-backgrounds-to-be-non-empty)

Empty `background`s will not cause errors in test executors but they create visual noise for people reading the test and it provides unclarity over the test writer's intentions.

### Requires the first step in a background to be Given

[](#requires-the-first-step-in-a-background-to-be-given)

Backgrounds provide shared scaffolding so they should always be an extension of the `arrange`phase, hence `Given`.

### Requires subsequent steps in a background to start with And

[](#requires-subsequent-steps-in-a-background-to-start-with-and)

Backgrounds provide shared scaffolding so they should always be an extension of the `arrange`phase, so subsequent steps to the first one are part of the same stage denoted by `And`.

### Requires indentation within backgrounds and scenario's to be constant

[](#requires-indentation-within-backgrounds-and-scenarios-to-be-constant)

This ensures there's a consistent left indentation for the eye to jump back to when reading the test file as test.

### Requires a blank line before When and Then blocks

[](#requires-a-blank-line-before-when-and-then-blocks)

This provides the visual separation between the different phases in a test allowing for easy scannability.

### Requires the first step in a scenario to be Given

[](#requires-the-first-step-in-a-scenario-to-be-given)

The first step in a test should be to `arrange` the system into a known working state, this is signaled by `Given`.

### Requires Given, When, and Then to occur exactly once in a scenario in order

[](#requires-given-when-and-then-to-occur-exactly-once-in-a-scenario-in-order)

Repetition of words signalling a certain stage indicate that a scenario should probably be split up. Enforcing the `Given`, `When`, and `Then` order enforces the `arrange`, `act`, and `assert`order of the scenario.

Contributing
------------

[](#contributing)

Any contributions are welcome. Cucumber Linter's source code open to pull requests lives at [`kingdutch/cucumber-linter-src`](https://github.com/kingdutch/cucumber-linter-src).

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance41

Moderate activity, may be stable

Popularity30

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity42

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 66.7% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~58 days

Recently: every ~101 days

Total

8

Last Release

495d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/4498046dbbae1c1f11f8d91955be52dd8800bdddd866a697b827011a589fe88d?d=identicon)[Kingdutch](/maintainers/Kingdutch)

---

Top Contributors

[![cucumber-linter-bot](https://avatars.githubusercontent.com/u/152017232?v=4)](https://github.com/cucumber-linter-bot "cucumber-linter-bot (16 commits)")[![Kingdutch](https://avatars.githubusercontent.com/u/327697?v=4)](https://github.com/Kingdutch "Kingdutch (8 commits)")

---

Tags

devstatic analysisBehatCucumber

### Embed Badge

![Health badge](/badges/kingdutch-cucumber-linter/health.svg)

```
[![Health](https://phpackages.com/badges/kingdutch-cucumber-linter/health.svg)](https://phpackages.com/packages/kingdutch-cucumber-linter)
```

###  Alternatives

[phpstan/phpstan

PHPStan - PHP Static Analysis Tool

13.9k341.8M29.6k](/packages/phpstan-phpstan)[behat/gherkin

Gherkin DSL parser for PHP

1.1k176.3M97](/packages/behat-gherkin)[deptrac/deptrac

Deptrac is a static code analysis tool that helps to enforce rules for dependencies between software layers.

2.9k6.3M68](/packages/deptrac-deptrac)[phpstan/extension-installer

Composer plugin for automatic installation of PHPStan extensions

50398.1M8.3k](/packages/phpstan-extension-installer)[shipmonk/composer-dependency-analyser

Fast detection of composer dependency issues (dead dependencies, shadow dependencies, misplaced dependencies)

6156.7M435](/packages/shipmonk-composer-dependency-analyser)[staabm/phpstan-dba

2912.3M2](/packages/staabm-phpstan-dba)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
