behave-format¶
The opinionated formatter for Behave
.featurefiles.
Black is for Python. gofmt is for Go. behave-format is for Gherkin.
What it does¶
behave-format takes your Behave .feature files and produces clean, consistent,
deterministically formatted output — every time.
It consumes the canonical domain model from
behave-model and transforms it
into beautifully formatted .feature files.
Key principle¶
Separation of concerns
behave-format does NOT parse Gherkin. It does NOT lint. It does NOT validate.
It ONLY transforms a behave-model.Project into formatted .feature files.
- Parsing → behave-model
- Linting → behave-lint
- Formatting → behave-format
Features¶
- :octicons-settings-16: Opinionated — minimal configuration, sensible defaults that just work
- :octicons-repeat-16: Deterministic — same input always produces the same output
- :octicons-check-circle-16: Idempotent —
format(format(x)) == format(x) - :octicons-zap-16: Fast — handles thousands of feature files efficiently
- :octicons-terminal-16: CI-friendly —
--checkmode with exit code 1 when formatting is needed - :octicons-shield-check-16: Safe — never changes semantics (names, step text, table values, docstrings)
- :octicons-tools-16: Pre-commit ready — drop-in hook for your pre-commit configuration
- :octicons-keyboard-16: Stdin support — integrate with any editor via
--stdin
Quick start¶
Before / After¶
Ecosystem¶
behave-format is part of the Behave tooling ecosystem:
| Tool | Purpose |
|---|---|
| behave-model | Canonical domain model & Gherkin parser |
| behave-format | Opinionated formatter for .feature files |
| behave-lint | Linter for Gherkin .feature files |
Next steps¶
- Installation — get up and running
- Quick Start — format your first files
- Formatting Rules — understand what the formatter does
- Configuration — customize behavior via
pyproject.toml - CLI Usage — full CLI reference