Skip to main content
mehen metrics is the single-file analysis command. It takes one path, auto-detects the language, and emits a complete metrics report.
mehen metrics [OPTIONS] <PATH>
ArgumentDescription
<PATH>Path to the file to analyze. mehen metrics never walks directories.
FlagDefaultDescription
--language <LANGUAGE>auto-detectedOverride language detection. Accepts canonical names or aliases (e.g. python, py, ts, tsx, markdown, md).
--format <FORMAT>jsonOne of json, markdown, yaml, toml.
--prettyoffPretty-print JSON output.
--profile <PROFILE>defaultOne of default, ci, strict.

Examples

mehen metrics src/main.py

Exit codes

CodeMeaning
0Success.
1IO error, unsupported language, or analyzer-fatal diagnostic on this file.
3Invalid serialization state — should not happen in production runs.

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 a contributions 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:
ProfileUse case
defaultLocal developer output, including supported contribution evidence. No implicit failure policy.
ciGitHub Action-friendly defaults without contribution evidence. Stable tables, standard metric selector set.
strictSame evidence behavior as ci, with tighter built-in threshold suggestions.
Explicit CLI flags always override profile defaults.

Inspecting contribution evidence

Maintainers can print only the contribution array for a file through the developer task:
cargo xtask metric-contributions migrations/2026-07-10.sql
The task runs the production analyzer through the real mehen metrics path, so language detection, profile behavior, reason codes, and spans match the public CLI report.

See also