Static analysis and diagnostics for Behave BDD suites.
Project description
behave-doctor
Static analysis and diagnostics for Behave BDD suites.
behave-doctor inspects your Behave .feature files and Python step
definitions without executing them, surfacing issues like unused step
definitions, undefined steps, oversized features, inconsistent tags, and
circular import dependencies.
Features
- 18 diagnostic rules across 5 categories (structure, quality, coverage, complexity, dependencies).
- 3 output formats: human-readable text, JSON, and SARIF 2.1.0 for GitHub Code Scanning.
- Zero runtime dependencies beyond
behave-model— pure Python, fully typed, mypy --strict clean. - Configurable via
[tool.behave-doctor]inpyproject.toml. - Python API for embedding in custom tooling.
Quick start
pip install behave-doctor
behave-doctor scan .
Scanning . ...
Found 12 features, 47 scenarios, 213 steps, 89 step definitions.
BD301 WARNING Unused step definition: "the user clicks submit" (features/steps/auth.py:42)
BD302 ERROR Undefined step: "Given the database is seeded" (features/login.feature:18)
1 errors, 1 warnings in 0.42s
Rules
| ID | Name | Severity | Category |
|---|---|---|---|
| BD101 | feature-count | info | Structure |
| BD102 | scenario-count | info | Structure |
| BD103 | step-count | info | Structure |
| BD104 | tag-coverage | info | Structure |
| BD201 | duplicate-step-defs | error | Quality |
| BD202 | scenario-no-tags | warning | Quality |
| BD203 | feature-too-many-scenarios | warning | Quality |
| BD204 | inconsistent-tag-casing | warning | Quality |
| BD301 | unused-step-def | warning | Coverage |
| BD302 | undefined-step | error | Coverage |
| BD303 | unused-tag | info | Coverage |
| BD304 | orphan-scenario | warning | Coverage |
| BD401 | scenario-too-many-steps | warning | Complexity |
| BD402 | step-too-many-params | warning | Complexity |
| BD403 | feature-too-large | warning | Complexity |
| BD501 | circular-dependency | error | Dependency |
| BD502 | unused-import | warning | Dependency |
| BD503 | missing-step-module | error | Dependency |
Configuration
# pyproject.toml
[tool.behave-doctor]
features_dir = "features"
steps_dir = "features/steps"
min_severity = "hint"
exclude_tags = ["@smoke", "@wip"]
[tool.behave-doctor.rules.BD203]
max_scenarios = 15
[tool.behave-doctor.rules.BD401]
max_steps = 8
Python API
from behave_doctor import scan_project
report = scan_project("path/to/project")
for d in report.diagnostics:
print(f"{d.rule_id}: {d.message} at {d.file}:{d.line}")
print(f"Exit code: {report.exit_code}")
CI/CD
- run: pip install behave-doctor
- run: behave-doctor scan . --format sarif -o behave-doctor.sarif
- uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: behave-doctor.sarif
Documentation
Full documentation at https://mathiaspaulenko.github.io/behave-doctor/.
License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file behave_doctor-1.0.0.tar.gz.
File metadata
- Download URL: behave_doctor-1.0.0.tar.gz
- Upload date:
- Size: 47.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
08a95a0a647e41bf263fdaa8bc0515d0913e72cf201897a3468b127ad188f955
|
|
| MD5 |
8b62e8c008c9a00f7cbfddd12af9ab60
|
|
| BLAKE2b-256 |
d8ea1721391b3dd69a1a2cb8496dfc3ac5b3340510d377606bd256e569022724
|
Provenance
The following attestation bundles were made for behave_doctor-1.0.0.tar.gz:
Publisher:
release.yml on MathiasPaulenko/behave-doctor
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
behave_doctor-1.0.0.tar.gz -
Subject digest:
08a95a0a647e41bf263fdaa8bc0515d0913e72cf201897a3468b127ad188f955 - Sigstore transparency entry: 2218910816
- Sigstore integration time:
-
Permalink:
MathiasPaulenko/behave-doctor@5bb7a24d038cccfaa33efe3a1f723c448c923882 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/MathiasPaulenko
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@5bb7a24d038cccfaa33efe3a1f723c448c923882 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file behave_doctor-1.0.0-py3-none-any.whl.
File metadata
- Download URL: behave_doctor-1.0.0-py3-none-any.whl
- Upload date:
- Size: 37.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
67c8740c910f0d0b3058b7daae68bd71aa966752345d2ab47dd987660acc245d
|
|
| MD5 |
641c46dd154e78d590df42cb8eff85be
|
|
| BLAKE2b-256 |
9f1de43d39abeefe4a77e0079827eb4173a0ccde7d8e49e64d0aed52af5eba9d
|
Provenance
The following attestation bundles were made for behave_doctor-1.0.0-py3-none-any.whl:
Publisher:
release.yml on MathiasPaulenko/behave-doctor
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
behave_doctor-1.0.0-py3-none-any.whl -
Subject digest:
67c8740c910f0d0b3058b7daae68bd71aa966752345d2ab47dd987660acc245d - Sigstore transparency entry: 2218911176
- Sigstore integration time:
-
Permalink:
MathiasPaulenko/behave-doctor@5bb7a24d038cccfaa33efe3a1f723c448c923882 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/MathiasPaulenko
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@5bb7a24d038cccfaa33efe3a1f723c448c923882 -
Trigger Event:
workflow_dispatch
-
Statement type: