Class AcceptableCouplingOrError

java.lang.Object
org.ek9lang.compiler.phase5.AcceptableCouplingOrError
All Implemented Interfaces:
Consumer<org.antlr.v4.runtime.tree.ParseTree>

class AcceptableCouplingOrError extends Object implements Consumer<org.antlr.v4.runtime.tree.ParseTree>
Checks efferent coupling (Ce) against thresholds and emits errors if exceeded. Based on CBO (Coupling Between Objects) from Chidamber & Kemerer (1994).

Thresholds are calibrated from analysis of the EK9 compiler source code:

  • class: max 12 (MethodSymbol/AggregateSymbol typically 6-7)
  • record: max 8 (should stay focused)
  • trait: max 8 (interface-like, minimal dependencies)
  • service/component: max 15 (entry points naturally higher)
  • function: max 8 (parameter coupling only)
  • Constructor Details

  • Method Details

    • accept

      public void accept(org.antlr.v4.runtime.tree.ParseTree node)
      Specified by:
      accept in interface Consumer<org.antlr.v4.runtime.tree.ParseTree>