File naming
file_naming
TEST_QUALITY_FILE_NAMING rule.
For every integration / e2e test file, derive the canonical test_*.py
filename from the top-K=2 tuple of (first-party symbols | CLI invocations)
and compare with the current basename. Three verdicts:
NAME_MISMATCH(INFO) — the file uses a name that diverges from the canonical tuple. Surfaced as signal, not as a defect: cohesive packages often pick human scenario names that beat the canonical tuple.SPLIT(WARNING) — the file holds tests that map to multiple distinct canonical tuples. A structural problem of the file boundary, regardless of the chosen name.COLLIDE(WARNING) — two or more files in the same tier emit the same canonical name. Same structural-boundary problem viewed in the other direction.
The rule auto-skips tests/unit/ (handled by PRACTICE_TEST_MIRROR)
and respects a file-level / per-test pytest.mark.scenario_name_ok
marker that suppresses NAME_MISMATCH (only).
FileNamingRule
Bases: ProjectRule
Surface integration / e2e test files whose name diverges from the canonical tuple, or whose tests structurally belong in several files.
Source code in packages/axm-audit/src/axm_audit/core/rules/test_quality/file_naming.py
rule_id
property
Stable identifier for this rule.
check(project_path)
Scan integration/e2e tests and emit naming findings.
Source code in packages/axm-audit/src/axm_audit/core/rules/test_quality/file_naming.py
compute_canonical_name(test_file, project_path)
Public canonical-name helper for one integration/e2e test file.
Returns None when the file is not in an integration/e2e tier,
has no tests, or has no first-party symbol coverage. Otherwise
returns the canonical test_*.py basename FILE_NAMING would emit.
Source code in packages/axm-audit/src/axm_audit/core/rules/test_quality/file_naming.py
render_findings_text(findings)
Render top-N findings as a compact bullet list.
Caps at _MAX_TEXT_WARNINGS warnings + _MAX_TEXT_INFOS infos.
Returns None for empty input, matching the convention used by
render_clusters_text for the passing case.