skillfed

reformat-gherkin

Formatter for Gherkin language

reformat-gherkin v3.0.1 170.5K downloads/30d#10,393 on PyPI32
Permissive license MIT Active released

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-gherkin

uv

uv add reformat-gherkin

poetry

poetry add reformat-gherkin

Installing 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

Development Status :: 5 - Production/StableEnvironment :: ConsoleIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Topic :: Software Development :: Quality Assurance

Tags

gherkin formatterfeature file formattingbdd test formattinggherkin code stylepre-commit gherkincucumber feature formattergherkin linter
bdd-testingcode-formatterpre-commit-hook

More Quality Assurance packages