Formatters
formatters
Output formatters for audit results โ human-readable and JSON.
format_agent(result)
Agent-optimized output: passed=summary, failed=full detail.
Minimizes tokens for passing checks while giving full context on
failures. For failed checks, text and details are both included
when present (None values are omitted). Passed checks that
carry actionable detail (e.g. missing docstrings) are promoted to dicts.
Rule-specific metadata (e.g. tautology verdicts, duplicate clusters,
pyramid mismatches) is propagated verbatim under the metadata key
on both passed and failed entries when non-empty.
Source code in packages/axm-audit/src/axm_audit/formatters.py
format_agent_text(data, category=None)
Render agent-format audit data as compact text for LLM consumption.
Consumes the dict produced by format_agent and returns a minimal
text representation optimised for token count.
Source code in packages/axm-audit/src/axm_audit/formatters.py
format_json(result)
Format audit result as JSON-serializable dict.
Source code in packages/axm-audit/src/axm_audit/formatters.py
format_report(result)
Format audit result as human-readable category-grouped report.
Source code in packages/axm-audit/src/axm_audit/formatters.py
format_test_quality_json(result)
JSON superset: clusters + verdicts + pyramid + private violations.
Source code in packages/axm-audit/src/axm_audit/formatters.py
format_test_quality_text(result, mismatches_only=False)
Render test-quality findings grouped by rule.
Order: private imports โ pyramid โ duplicates โ tautologies.
With mismatches_only=True only the pyramid section is emitted,
filtered to entries whose folder differs from the classified level.