Class ConstructMetrics
- All Implemented Interfaces:
Function<ISymbol, FunctionMetrics>
CoverageProbePlacer. Hold an instance; do not re-derive the lookup, and do not
pass FunctionMetrics.EMPTY as a placeholder.
Sibling to CoverageDisplayName (it carries CoverageIdentity, the join key), and read by
FunctionProbes.enter(CoverageProbePlacer, ISymbol, DebugInfo), THE registration every generator uses. When it was written there were four
registering generators (OperationDfnGenerator, AggregateDfnGenerator, ServiceDfnGenerator,
TextDfnGenerator) and three passed EMPTY, so every
method and operator of every class, record, trait, component, service and text construct reported
zero for all metrics — complexity, cognitive, nesting, statements, expressions, injections
and coupling alike. Only free functions, which go through OperationDfnGenerator, ever
carried real numbers. Any per-construct quality signal built on that data would have read every
aggregate member as trivial and perfectly safe.
Two lookup rules, and they differ deliberately:
- Body metrics (complexity, cognitive, nesting, statements, expressions, injections) are
the operation's own, falling back to the enclosing scope only when the operation carries none
at all — the synthetic-method case, where phase 5 measured the declaration rather than the
generated
_call. - Coupling is always inherited from the enclosing type, because efferent coupling is a property of the construct, not of an operation within it. Phase 5 chains its coupling check onto construct declarations only — never onto a method or operator — so an operation's own symbol never carries it. Every method of a twelve-dependency class is risky to change because the class is entangled; that is the sense in which coupling is change risk.
- Defaulted is provenance rather than a metric, read straight off the phase-1
DEFAULTEDmarker. It travels with the metrics because the consumer that needs it (change-risk ranking) has only this record to go on, and the alternative — inferring "the compiler wrote this" from zero body metrics — is wrong for every trivial hand-written method.
-
Constructor Details
-
ConstructMetrics
public ConstructMetrics()
-
-
Method Details
-
apply
Resolve every phase-5 metric for one operation.- Specified by:
applyin interfaceFunction<ISymbol, FunctionMetrics>- Parameters:
symbol- the operation's symbol- Returns:
- its metrics, or
FunctionMetrics.EMPTYwhen phase 5 recorded nothing for it
-