Skip to main content
A space is mehen’s language-aware container for a function, method, class, trait, interface, module, or file. Spaces nest: a method lives inside a class which lives inside a file. Most metrics are reported per space, and aggregates roll up to the parent.

Why a single abstraction

Different languages call their containers different things — a Python class is not literally a Java class is not a Rust impl. But for metric purposes they all play the same structural role:
  • They contain functions/methods.
  • They define a scope for visibility (public / private).
  • They are addressable in tools and reports.
mehen’s Space abstraction unifies them so the engine, metric finalizers, and reporters can speak one vocabulary across languages.

Space kinds

Aggregation

Every metric is computed at the leaf space (where it makes sense — a function for cyclomatic, a class for NPM, etc.) and then aggregated up to the file:
  • Sum for additive metrics (cyclomatic.sum, nom.functions).
  • Average for ratios (cyclomatic.average, nom.average_functions).
  • Min / max for distribution endpoints (cyclomatic.min, cyclomatic.max).
Aggregation rules live in mehen-metrics. Per-language analyzers decide which kind each tree node becomes.

See also