CLI Reference

July 3, 2026 ยท View on GitHub

Synopsis

behave-lint [OPTIONS] [PATHS]...

Positional arguments

ArgumentDescription
PATHSFiles or directories to lint. Defaults to current directory.

Rule selection

OptionDescription
--select RULESEnable specific rules (comma-separated). Overrides configuration.
--ignore RULESDisable specific rules (comma-separated). Overrides configuration.
--profile NAMEUse a built-in profile: recommended, strict, minimal.
--fail-on LEVELExit with non-zero code if diagnostics at or above this severity are found. One of error, warning, info. Default: warning.

Output

OptionDescription
--output FORMATOutput format: console, json, markdown, sarif, github. Default: console.
--output-file FILEWrite output to file instead of stdout.
--colorForce enable colored output.
--no-colorForce disable colored output.
--verboseShow progress and timing information.
--quietSuppress all output except diagnostics.
--statisticsShow rule statistics summary.

Configuration

OptionDescription
--config FILEExplicit path to pyproject.toml.
--no-cacheDisable cache for this run.
--clear-cacheClear cache before running.

Auto-fix

OptionDescription
--fixApply safe auto-fixes to .feature files.
--unsafe-fixesAlso apply unsafe auto-fixes (use with caution).

Watch mode

OptionDescription
--watchWatch for file changes and re-lint automatically. Requires watchdog (pip install behave-lint[watch]).

Informational

OptionDescription
--list-rulesList all available rules and exit.
--explain RULE_IDShow documentation for the specified rule and exit.
--versionShow version and exit.
--helpShow help message and exit.

Exit codes

CodeMeaning
0No diagnostics at or above the --fail-on threshold.
1Diagnostics found at or above the threshold.
2Internal error (invalid arguments, parse failure, etc.).

Examples

# Lint all features in the current directory
behave-lint .

# Lint with JSON output to a file
behave-lint features/ --output json --output-file report.json

# Apply safe fixes
behave-lint features/ --fix

# Lint with only correctness rules
behave-lint features/ --select BC001,BC002,BC003,BC004,BC005,BC006

# Use the strict profile (all rules including pedantic)
behave-lint features/ --profile strict

# Use the minimal profile (only correctness + step definitions)
behave-lint features/ --profile minimal

# Explain a rule
behave-lint --explain BD005

# Watch for changes and re-lint automatically
behave-lint features/ --watch