Code auditing and quality rules for AXM
Project description
axm-audit — Code auditing and quality rules for Python projects
axm-audit audits Python project quality across 10 scored categories, producing a composite 0–100 score with an A–F grade. It works as a CLI, Python API, and MCP tool for AI agents.
Features
- 🔍 Linting — Ruff analysis (800+ rules)
- 🔒 Type Checking — Strict mypy (per-project
pyproject.tomlconfig) - 📊 Complexity — Cyclomatic complexity via radon (Python API with subprocess fallback)
- 🛡️ Security — Bandit integration + hardcoded secrets detection
- 📦 Dependencies — Vulnerability scanning (pip-audit) + hygiene (deptry)
- 🧪 Testing — Coverage enforcement via pytest-cov
- 🏗️ Architecture — Circular imports, god classes, coupling metrics, duplication detection
- 📐 Practices — Docstring coverage, bare except detection, hardcoded secrets, blocking I/O, logging presence, test mirroring
- 🔧 Tooling — CLI tool availability checks
- 📈 Composite Scoring — Weighted 10-category 0–100 score with A–F grade
Installation
uv add axm-audit
Quick Start
CLI
# Full audit
axm-audit audit .
# JSON output
axm-audit audit . --json
# Agent-optimized output (compact, actionable)
axm-audit audit . --agent
# Filter by category
axm-audit audit . --category lint
# Run tests with structured output (agent-optimized)
axm-audit test . --mode=compact
Python API
from pathlib import Path
from axm_audit import audit_project
result = audit_project(Path("."))
print(f"Grade: {result.grade} ({result.quality_score:.1f}/100)")
print(f"Checks: {result.total - result.failed}/{result.total} passed")
for check in result.checks:
if not check.passed:
print(f" ❌ {check.rule_id}: {check.message}")
if check.fix_hint:
print(f" Fix: {check.fix_hint}")
MCP (AI Agent)
axm-audit is available as an MCP tool via axm-mcp. AI agents can call audit(path) or verify(path) directly:
# Agent-optimized output: passed checks as compact strings,
# failed checks as dicts with rule_id, message, details, fix_hint
from axm_audit.formatters import format_agent
data = format_agent(result)
# data["score"], data["grade"], data["passed"], data["failed"]
See the MCP how-to guide for details.
Scoring Model
10-category weighted composite on a 100-point scale:
| Category | Weight | Tool |
|---|---|---|
| Linting | 20% | Ruff |
| Type Safety | 15% | mypy |
| Complexity | 15% | radon |
| Security | 10% | Bandit |
| Dependencies | 10% | pip-audit + deptry |
| Testing | 15% | pytest-cov |
| Architecture | 10% | AST analysis |
| Practices | 5% | AST analysis |
Categories
| Category | Rules | Count |
|---|---|---|
lint |
LintingRule, FormattingRule, DiffSizeRule, DeadCodeRule |
4 |
type |
TypeCheckRule |
1 |
complexity |
ComplexityRule |
1 |
security |
SecurityRule (Bandit), SecurityPatternRule |
2 |
deps |
DependencyAuditRule, DependencyHygieneRule |
2 |
testing |
TestCoverageRule |
1 |
architecture |
CircularImportRule, GodClassRule, CouplingMetricRule, DuplicationRule |
4 |
practices |
DocstringCoverageRule, BareExceptRule, BlockingIORule, LoggingPresenceRule, TestMirrorRule |
5 |
structure |
PyprojectCompletenessRule |
1 |
tooling |
ToolAvailabilityRule |
3 |
Witness Rules
axm-audit ships a witness rule for use with the axm.witnesses entry point group:
| Rule | Entry point key | Default categories |
|---|---|---|
AuditQualityRule |
audit_quality |
lint, type |
AuditQualityRule runs audit_project for each configured category independently (a lint failure does not prevent type checking) and returns structured agent-friendly feedback via format_agent.
Development
This package is part of the axm-forge workspace.
git clone https://github.com/axm-protocols/axm-forge.git
cd axm-forge
uv sync --all-groups
uv run --package axm-audit --directory packages/axm-audit pytest -x -q
License
Apache-2.0 — © 2026 axm-protocols
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 axm_audit-0.7.0.tar.gz.
File metadata
- Download URL: axm_audit-0.7.0.tar.gz
- Upload date:
- Size: 107.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0fe4248705e329af9b9fad543dec4fe61b436a2ea024fd2b46ccbf684c5a75f9
|
|
| MD5 |
ba535d99fc897b0320dd458a0654aaba
|
|
| BLAKE2b-256 |
3a0f6b586fd4ba929d7e51320a87f752c0e964e607897990ff634a80a1b2f649
|
Provenance
The following attestation bundles were made for axm_audit-0.7.0.tar.gz:
Publisher:
publish.yml on axm-protocols/axm-forge
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
axm_audit-0.7.0.tar.gz -
Subject digest:
0fe4248705e329af9b9fad543dec4fe61b436a2ea024fd2b46ccbf684c5a75f9 - Sigstore transparency entry: 1197670514
- Sigstore integration time:
-
Permalink:
axm-protocols/axm-forge@3139318fce81fa7c9b3e9c42ec27f92dd88b386d -
Branch / Tag:
refs/tags/audit/v0.7.0 - Owner: https://github.com/axm-protocols
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@3139318fce81fa7c9b3e9c42ec27f92dd88b386d -
Trigger Event:
push
-
Statement type:
File details
Details for the file axm_audit-0.7.0-py3-none-any.whl.
File metadata
- Download URL: axm_audit-0.7.0-py3-none-any.whl
- Upload date:
- Size: 59.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d94e2dfaf51cf07633d3d62f9f6c066a71e49714ecba2e19e83715f532377ecc
|
|
| MD5 |
c20fcc9d218e94b09e91cb4790910502
|
|
| BLAKE2b-256 |
62b4d2e5a5379703ad9a1a96a241106706a66d77fa7d8df5db82e41f3dc7e3d8
|
Provenance
The following attestation bundles were made for axm_audit-0.7.0-py3-none-any.whl:
Publisher:
publish.yml on axm-protocols/axm-forge
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
axm_audit-0.7.0-py3-none-any.whl -
Subject digest:
d94e2dfaf51cf07633d3d62f9f6c066a71e49714ecba2e19e83715f532377ecc - Sigstore transparency entry: 1197670543
- Sigstore integration time:
-
Permalink:
axm-protocols/axm-forge@3139318fce81fa7c9b3e9c42ec27f92dd88b386d -
Branch / Tag:
refs/tags/audit/v0.7.0 - Owner: https://github.com/axm-protocols
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@3139318fce81fa7c9b3e9c42ec27f92dd88b386d -
Trigger Event:
push
-
Statement type: