Plugin Development

July 3, 2026 ยท View on GitHub

Plugins extend behave-lint with custom rules, reporters, or configuration providers.

Plugin types

TypeEntry point groupDescription
Rulesbehave_lint.rulesCustom lint rules
Reportersbehave_lint.reportersCustom output formats
Configbehave_lint.config_sourcesConfiguration providers

Quick start with the cookiecutter template

The fastest way to create a plugin is using the cookiecutter template included in this repository:

# Install cookiecutter
pip install cookiecutter

# Generate a plugin from the template
cookiecutter https://github.com/MathiasPaulenko/behave-lint --directory templates/cookiecutter-plugin

You'll be prompted for:

FieldDescriptionExample
project_namePyPI package namebehave-lint-acme-rules
plugin_namePython module nameacme_rules
class_namePascalCase rule class nameAcmeRules
rule_idUnique rule IDXA001
rule_nameKebab-case rule nameacme-check
rule_titleHuman-readable titleAcme compliance check
categoryRule categorystyle, correctness, etc.
severityDefault severitywarning, error, info
include_auto_fixInclude auto-fix skeletonyes or no

The generated project includes:

  • pyproject.toml with entry points configured
  • Rule skeleton with RuleMetadata, check(), and optional get_fixes()
  • Test suite with fixtures
  • README with usage examples
  • MIT LICENSE
  • .gitignore

Creating a plugin manually

1. Set up your package

[project]
name = "behave-lint-my-plugin"
version = "0.1.0"
requires-python = ">=3.11"

[project.entry-points."behave_lint.rules"]
my-rule = "my_plugin.rules:MyCustomRule"

2. Implement your rule

See the Custom Rules guide for the full rule implementation example.

3. Implement a custom reporter

from behave_lint.models.lint_result import LintResult
from behave_lint.reporters.base import Reporter
from typing import ClassVar


class MyReporter(Reporter):
    """Custom reporter that outputs diagnostics as CSV."""

    name: ClassVar[str] = "csv"
    supports_file_output: ClassVar[bool] = True
    supports_stdout: ClassVar[bool] = True

    def render(self, result: LintResult, output_file: str | None = None) -> None:
        lines = ["rule_id,severity,file,line,message"]
        for d in result.diagnostics:
            lines.append(
                f"{d.rule_id},{d.severity},"
                f"{d.file_path},{d.line},{d.message}"
            )
        content = "\n".join(lines)
        self._write_output(content, output_file)

Register it:

[project.entry-points."behave_lint.reporters"]
csv = "my_plugin.reporters:MyReporter"

4. Install and test

pip install -e .
behave-lint features/ --output csv

Plugin isolation

Plugins are loaded in isolated mode โ€” a failure in one plugin does not crash the linter. Errors are reported as warnings.

Discovery

behave-lint discovers plugins via Python entry points. Ensure your plugin package is installed in the same environment as behave-lint.