Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mehen.ophi.dev/llms.txt

Use this file to discover all available pages before exploring further.

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

KindExamples
FileAlways the root space.
FunctionTop-level functions, methods.
ClosureLambdas / closures / arrow functions.
Classclass, record, data class.
Interfaceinterface, trait, protocol.
TraitRust traits, Kotlin traits where distinct.
ImplRust impl blocks.
ModuleFiles / Rust mod / Python class-as-namespace where applicable.

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