Configuration

July 3, 2026 · View on GitHub

behave-lint reads configuration from pyproject.toml under the [tool.behave-lint] section. Configuration is merged from multiple sources with well-defined precedence.

Configuration sources

Configuration is resolved in order of increasing precedence (higher overrides lower):

  1. Built-in defaults (lowest)
  2. Profile (if specified via --profile, profile in config, or BEHAVE_LINT_PROFILE)
  3. pyproject.toml[tool.behave-lint] section
  4. Environment variablesBEHAVE_LINT_* prefix
  5. CLI flags (highest)

Merge rules

  • Scalars (str, bool, int): highest precedence wins (replaces).
  • Lists (select, ignore, paths, exclude): highest precedence wins (replaces, no concatenation).
  • Dicts (severity, plugins, rules): merged (highest precedence keys override matching lower keys).

Configuration file

behave-lint searches for pyproject.toml starting from the current directory and walking up to the filesystem root. The first pyproject.toml containing a [tool.behave-lint] section is used.

[tool.behave-lint]
profile = "recommended"
select = ["BC001", "BC004", "BS001"]
ignore = ["BP001", "BP002"]
fail-on = "warning"
output = "console"
paths = ["features/"]
exclude = ["features/legacy/"]

Use --config to specify an explicit path:

behave-lint --config /path/to/pyproject.toml features/

Options

Rule selection

OptionTypeDefaultDescription
selectlist[str][] (all)Rule IDs to enable. Empty means all defaults.
ignorelist[str][]Rule IDs to disable.
profilestr"none"Built-in profile: recommended, strict, minimal. See Profiles.
excludelist[str][]Paths to exclude from linting.

Severity

OptionTypeDefaultDescription
fail-onstr"warning"Minimum severity for non-zero exit: error, warning, info.
severitydict{}Per-rule severity overrides.
max-warningsint-1Max warnings before non-zero exit (-1 = no limit).

Severity overrides

The TOML key is severity (not severity-overrides):

[tool.behave-lint.severity]
BC001 = "warning"
BX001 = "error"
BD003 = "info"

Valid severity values: error, warning, info, off.

Rule parameters

Some rules are configurable with parameters. The TOML key is rules (not rule-params):

[tool.behave-lint.rules]
BX001 = { max-steps = 8 }
BX002 = { max-scenarios = 5 }
BX003 = { max-example-rows = 15 }
BX004 = { max-step-length = 100 }
BX005 = { max-tags = 5 }
BP003 = { min-length = 10 }
BP004 = { min-length = 10 }
RuleParameterDefaultDescription
BX001max-steps10Maximum steps per scenario.
BX002max-scenarios10Maximum scenarios per feature.
BX003max-example-rows20Maximum rows per Examples table.
BX004max-step-length120Maximum step text length (characters).
BX005max-tags5Maximum tags per element.
BP003min-length10Minimum scenario name length (characters).
BP004min-length10Minimum feature name length (characters).

Output

OptionTypeDefaultDescription
outputstr"console"Output format: console, json, markdown, sarif, github.
output-filestrnullWrite output to file instead of stdout.

Paths

OptionTypeDefaultDescription
pathslist[str]["features/"]Default paths to lint.
step-definitionsstrnullStep definitions directory.

Cache

OptionTypeDefaultDescription
cachebooltrueEnable caching.
cache-dirstr".behave-lint-cache"Cache directory.

Plugins

OptionTypeDefaultDescription
pluginsdict{}Plugin enable/disable map.
[tool.behave-lint]
plugins = { "my-plugin" = true, "deprecated-plugin" = false }

Extends

OptionTypeDefaultDescription
extendsstrnullPath to another config file to extend.

Environment variables

All environment variables use the BEHAVE_LINT_ prefix:

VariableMaps toTypeDescription
BEHAVE_LINT_OUTPUToutputstrOutput format.
BEHAVE_LINT_OUTPUT_FILEoutput_filestrOutput file path.
BEHAVE_LINT_NO_CACHEcachebool (inverted)Set to 1/true/yes to disable cache.
BEHAVE_LINT_CACHE_DIRcache_dirstrCache directory.
BEHAVE_LINT_FAIL_ONfail_onstrFail-on severity level.

Example:

BEHAVE_LINT_OUTPUT=json BEHAVE_LINT_FAIL_ON=error behave-lint features/

Key aliases

Some keys accept both kebab-case and snake_case in TOML:

Kebab-caseSnake_case
output-fileoutput_file
step-definitionsstep_definitions
cache-dircache_dir
fail-onfail_on

CLI overrides

All configuration options can be overridden via CLI flags. CLI flags take precedence over the configuration file and environment variables. See the CLI Reference for details.