mehen metrics is the single-file analysis command. It takes one path, auto-detects the language, and
emits a complete metrics report.
Examples
- JSON (default)
- Pretty JSON
- Markdown report
- Forced language
- CI profile
- With coverage
Exit codes
Configured thresholds
When amehen.toml is present, every configured threshold that matches a metric
this file publishes is evaluated against the report — the language’s override table wins over the
global one. Crossed limits print a grouped violation report on stderr after the report lands on
stdout, and the command exits 1. Files with blocking parse diagnostics exit 1 without
threshold evaluation: partial metrics are never gated.
What gets reported
Source-code files yield the code metric family (cyclomatic, cognitive, Halstead, MI, ABC, LOC family, NOM, NPA, NPM, NARGS, NEXITS, WMC). Markdown files yield the Markdown metric suite — DMI, MRPC, MCC, Markdown Halstead, link debt, table burden, visual scaffold, artifact debt, repository grounding, evidence coverage, filler/lazy risk, review criticality, section balance, good scaffold. The opt-in prose layer ships behind Cargo features. When an analyzer supports source-resolved evidence, the default profile also emits acontributions array. Each entry identifies the metric, weighted amount, stable reason code, and
byte/line span responsible for that amount. SQL change risk is the first supported metric:
sql.change_risk_score explains destructive DDL/DML and distinct object-touch terms. The
ci/strict profiles skip this optional evidence to keep automated payloads lean.
Profiles
--profile selects a built-in preset for what gets reported and how thresholds are interpreted:
Explicit CLI flags always override profile defaults.
Inspecting contribution evidence
Maintainers can print only the contribution array for a file through the developer task:mehen metrics path, so language detection,
profile behavior, reason codes, and spans match the public CLI report.
See also
mehen diff— compare metrics between revisions.mehen top-offenders— rank files by metric.- Concepts → Output formats — schema details.