Interface MetricLimit

All Known Implementing Classes:
MetricLimit.CompoundLimit, MetricLimit.GenusLimit, MetricLimit.RatioLimit, MetricLimit.ScalarLimit

A single enforced quality/architecture metric limit, self-describing enough that BOTH the phase-5 checker that fires the error AND the MCP/IDE enquiry layer that reports headroom can read it from the one place — see MetricLimits for the registry and the rationale.

The seven gates are genuinely heterogeneous, so this is a sealed hierarchy rather than one record with a soup of nullable fields:

  • MetricLimit.ScalarLimit — a single threshold with a comparator (E11016 module coupling, E11040 injection fields, E11042 registrations, E11043 injected-types-per-method).
  • MetricLimit.GenusLimit — a per-SymbolGenus threshold table with a fallback and a set of genera that are exempt entirely (E11015 construct coupling, E11014 LCOM4 cohesion).
  • MetricLimit.CompoundLimit — a multi-input compound condition guarded by a minimum size (E11017 module cohesion: absolute group cap AND relative disconnection ratio).

Fire-point parity. Each shape exposes an isOver(...) that is the EXACT predicate the checker uses to fire, and (for the scalar/genus shapes) a usableMax/limitFor from which the enquiry layer derives its bands — so "over" means "the checker would fire" and "at-limit" means "one more crosses", structurally, not by a re-implemented guess.

  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static enum 
    How a measured value is compared against the limit.
    static final record 
    A compound limit that fires only when an absolute cap AND a relative ratio are BOTH exceeded, and only once the module is at least minConstructs in size (small modules are naturally disconnected and are exempt).
    static final record 
    A per-genus threshold table: byGenus holds explicit limits, fallback covers genera not listed, and exempt genera are not checked at all (so MetricLimit.GenusLimit.limitFor(SymbolGenus) is empty and MetricLimit.GenusLimit.isOver(int, SymbolGenus) is always false for them).
    static final record 
    A gate on a fractional score rather than a count — E11020 multiplies a construct's complexity ratio by its statement ratio and fires above 0.50, so neither operand is a limit in its own right and the threshold cannot be an int.
    static final record 
    A single-threshold limit with a comparator.
  • Method Summary

    Modifier and Type
    Method
    Description
    Stable machine key for the metric (e.g.
    The EK9 error code this limit enforces (e.g.
  • Method Details

    • metricKey

      String metricKey()
      Stable machine key for the metric (e.g. "moduleCoupling") — the field name in enquiry JSON.
    • ruleCode

      String ruleCode()
      The EK9 error code this limit enforces (e.g. "E11016").