Edit on GitHub

RFC — Response for a Class

Class Metric  |  AST-based

The total number of distinct methods that can be invoked in response to a message sent to a class. Combines the class's own methods with the set of unique external method calls made from within the class body.

Formula

RFC = NOM + |unique callees|

where callees are distinct method/function names called from the class body (via call_expression and new_expression). Chained calls like arr.filter().map() contribute each callee individually.

Callee extraction rules

TypeScript Example

class Processor {
  run() {
    const data = this.fetch();   // callee: fetch (own)
    validate(data);              // callee: validate
    const svc = new Service();  // callee: Service
    svc.process(data);          // callee: process
  }
  fetch() { ... }              // own method
}
// NOM=2, unique callees={fetch,validate,Service,process}=4
// RFC = 2 + 4 = 6

Thresholds

RFC is informational only — no configurable thresholds. Values above ~50 indicate a class that is difficult to test in isolation.

Related metrics

CBO · WMC · NOM