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.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.
Why a single abstraction
Different languages call their containers different things — a Pythonclass 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.
Space abstraction unifies them so the engine, metric finalizers, and reporters can speak one
vocabulary across languages.
Space kinds
| Kind | Examples |
|---|---|
File | Always the root space. |
Function | Top-level functions, methods. |
Closure | Lambdas / closures / arrow functions. |
Class | class, record, data class. |
Interface | interface, trait, protocol. |
Trait | Rust traits, Kotlin traits where distinct. |
Impl | Rust impl blocks. |
Module | Files / 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).
mehen-metrics. Per-language analyzers decide which kind each tree node
becomes.
See also
- Concepts → Architecture — where spaces sit in the pipeline.
- Code metrics overview — which metric is reported at which space kind.