reformat-gherkin
Formatter for Gherkin language
What it is and what it does
Reformat-gherkin is a command-line formatter for Gherkin feature files used in behavior-driven development (BDD) testing. It reads .feature files and applies consistent formatting rules—controlling keyword alignment, indentation width, line endings, and tag layout—so that teams maintain a uniform style regardless of who wrote the file. The tool wraps gherkin-official for parsing and uses click for CLI handling.
It operates as a standalone command-line utility or integrates into pre-commit workflows. You can run it on individual files, directories, or stdin/stdout; use --check to validate without modifying; and configure defaults via a .reformat-gherkin.yaml file in your project. The tool follows Unix conventions: exits 0 on success, 1 if --check finds differences, and 123 on internal errors.
Use it for:
- Enforce consistent Gherkin formatting across a team's BDD test suite before commits via pre-commit hooks.
- Reformat legacy feature files to a standard style when adopting a new BDD framework or coding standard.
- Validate feature file formatting in CI/CD pipelines using the --check flag to catch style violations.
- Adjust indentation and keyword alignment in bulk across many feature files with a single command.
- Standardize line endings (LF vs. CRLF) across feature files in multi-platform development teams.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Automatically formats Gherkin feature files to enforce consistent style and indentation, available as a command-line tool or pre-commit hook.
Yes, if you maintain Gherkin feature files and want automated, consistent formatting. The package is lightweight, actively maintained, has no known vulnerabilities, and integrates cleanly with pre-commit workflows. The only caveat is that the last release was over 3 years ago; verify that it handles your specific Gherkin syntax and framework before relying on it in production pipelines.
Install
reformat-gherkin on PyPI
pip
pip install reformat-gherkinuv
uv add reformat-gherkinpoetry
poetry add reformat-gherkinInstalling reformat-gherkin
Before you install
Low friction: pure Python wheel with six runtime dependencies (PyYAML, attrs, cattrs, click, gherkin-official, wcwidth). Actively maintained with recent commits; last release was over 3 years ago but repository remains active.
License in practice
MIT license (permissive) places no restrictions on use, modification, or distribution in commercial or private projects.
Quickstart
pip install reformat-gherkin
reformat-gherkin path/to/feature.feature
# or with options:
reformat-gherkin --alignment right --tab-width 4 path/to/features/
Requires Python 3.7 or later.
Verify before relying
- Whether the package handles all Gherkin syntax variants (e.g., multiple languages, scenario outlines) without data loss.
- Performance characteristics on large feature file collections or deeply nested scenarios.
- Compatibility with specific BDD frameworks (Behave, pytest-bdd, etc.) beyond generic Gherkin parsing.
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.7,<4.0) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 6 — PyYAML, attrs, cattrs, click, gherkin-official, wcwidth |
| Maintenance | actively maintained — 1,410 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 170,452/month — #10,393 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: reformat_gherkin-3.0.1-py3-none-any.whl
Tags
More Quality Assurance packages
Coverage.py measures which lines of Python code…
permissive · top 1,000 on PyPI
ruffRuff is a Python linter and code formatter…
permissive · top 1,000 on PyPI
pexpectPexpect spawns and controls interactive console…
permissive · top 1,000 on PyPI
blackBlack reformats Python source code to a…
permissive · top 1,000 on PyPI
pytest-xdistpytest-xdist distributes pytest tests across…
permissive · top 1,000 on PyPI
cfn-lintValidates AWS CloudFormation templates in YAML…
permissive · top 1,000 on PyPI
gherkin-officialParses and compiles Gherkin feature files into…
permissive · top 5,000 on PyPI
yapfYAPF automatically reformats Python code to…
permissive · top 5,000 on PyPI
gersemigersemi is a command-line formatter for CMake…
copyleft · top 15,000 on PyPI
darkerDarker reformats Python source code in Git…
permissive · top 15,000 on PyPI
shfmt-pyProvides a Python-installable wrapper that…
permissive · top 15,000 on PyPI
blacken-docsApplies Black code formatting to Python code…
permissive · top 15,000 on PyPI
beautyshBeautysh automatically formats and beautifies…
permissive · top 15,000 on PyPI
pre-commit-hooksProvides a collection of reusable pre-commit…
permissive · top 5,000 on PyPI
clang-formatPackages the clang-format code formatter as a…
permissive · top 5,000 on PyPI
sort-linesAlphabetizes lines in files based on…
permissive · top 15,000 on PyPI