FAQ¶
Common questions and troubleshooting for behave-doctor.
General¶
Does behave-doctor execute my tests?¶
No. behave-doctor performs purely static analysis. It parses .feature
files with behave-model and analyzes Python step definitions with the
AST — never importing or executing them. There are no side effects, no
network calls, and no state changes.
Does behave-doctor depend on Behave?¶
No. behave-doctor's only runtime dependency is behave-model, which
provides the .feature file parser. behave-doctor does not import or
require the behave package itself. You can use behave-doctor on a project
that uses any version of Behave (or even a project that doesn't use Behave
at all but has .feature files).
What Python versions are supported?¶
Python 3.11, 3.12, 3.13, and 3.14. The CI pipeline tests all four versions on Ubuntu, macOS, and Windows.
Is behave-doctor fast?¶
Yes. behave-doctor typically completes in under 1 second for medium projects (50-100 feature files). The scan duration is printed at the end of the text report.
Rules¶
How do I disable a specific rule?¶
Via pyproject.toml:
Or via the CLI:
How do I disable all informational rules?¶
Set min_severity to "warning" to suppress all info diagnostics:
Or via the CLI:
How do I change a rule's threshold?¶
Via pyproject.toml:
See Configuration for all configurable thresholds.
Can I run only specific rules?¶
Yes:
Are rule IDs stable?¶
Yes. Rule IDs (BD101-503) are stable and will never change. They are
safe to reference in CI configurations, pre-commit hooks, and
pyproject.toml overrides.
Configuration¶
Where does behave-doctor look for pyproject.toml?¶
- The path specified by
--configon the CLI. pyproject.tomlin the project root (thePATHargument toscan).pyproject.tomlin the current working directory.
If no config file is found, all defaults are used.
Can I use a different config file name?¶
Yes, with --config:
The file must be a valid TOML file with a [tool.behave-doctor] section.
Do CLI flags override config file values?¶
Yes. CLI flags always take precedence over pyproject.toml values.
Integration¶
Does behave-doctor work with pre-commit?¶
Yes. See CI/CD > Pre-commit hook for configuration.
Does behave-doctor produce SARIF output?¶
Yes. Use --format sarif:
See Reporters > SARIF for details.
Can I use behave-doctor as a Python library?¶
Yes. See Python API for the full reference.
Troubleshooting¶
"No step definitions found in features/steps/"¶
This is BD503. It means the steps directory is empty, missing, or contains
no files with @given/@when/@then decorators.
Fixes:
- Verify
steps_dirin your config points to the correct directory. - Ensure your step files use
@given,@when, or@thendecorators (not@stepor custom decorators). - Check that the
.pyfiles are in the right location.
"Scan failed: features directory not found"¶
This produces exit code 2. It means the features_dir path doesn't exist.
Fixes:
- Verify
features_dirin your config points to the correct directory. - Pass the correct project path:
behave-doctor scan /path/to/project. - Use
--features-dirto override:behave-doctor scan . --features-dir my_features.
behave-doctor doesn't find my step definitions¶
Possible causes:
- Wrong
steps_dir— Check thatsteps_dirpoints to the directory containing your.pystep files. - Custom decorators — behave-doctor only recognizes
@given,@when,@then, and their aliases (@step,@Given,@When,@Then). If you use custom decorators, they won't be detected. - Dynamic step registration — Steps registered at runtime (e.g. via
behave.register_typeor dynamicstep_matcherchanges) cannot be detected statically.
The SARIF file is empty or has no results¶
Possible causes:
- No issues found — If the scan is clean, the SARIF file will contain the tool definition but no results. This is correct behavior.
- Severity filtering — If
min_severityis set toerrorand there are only warnings, no results will be produced. - All rules disabled — Check that rules aren't disabled in your
pyproject.toml.
behave-doctor is not detecting circular imports¶
Possible causes:
- Imports outside
features/steps/— behave-doctor only analyzes imports between modules in the steps directory. Imports from outside (e.g.from myapp.models import User) are not part of the dependency graph. - Dynamic imports —
importlib.import_module()or__import__()calls are not detected by AST analysis.
Performance¶
How can I speed up behave-doctor?¶
behave-doctor is already fast (typically under 1 second). If you have a very large project:
- Disable informational rules — Set
min_severity = "warning"to skip BD101-104 and BD303. - Run only the rules you care about — Use
--rules BD301,BD302. - Exclude
@wiptags — Useexclude_tagsto skip work-in-progress scenarios.
Does behave-doctor cache results?¶
No. behave-doctor performs a fresh scan on every run. This ensures deterministic results and avoids stale cache issues in CI.