/** * Pass #87: feature-envy (CWE-1060, category: architecture) * * @deprecated NOT REGISTERED IN THE DEFAULT PIPELINE * * This pass was removed from the default AnalysisPipeline in v3.14.0 because * the call-count heuristic (external_max ≥ 4 AND margin > 2) fires trivially * on legitimate delegation patterns — facades, controllers, service classes — * and its fix suggestion ("move this method to OtherClass") is incorrect when * the method's design intent is orchestration rather than feature envy. * Confirming true feature envy requires understanding design intent, which is * LLM territory. * * The raw signals this pass relies on are already present in CircleIR: * • ir.calls — per-callsite receiver, receiver_type, location.line * • ir.types — per-method start_line / end_line to scope the calls * * This file is retained so that circle-ir-ai can consume the per-method * call-count breakdown and apply semantic reasoning to distinguish genuine * feature envy from intentional delegation. * * Detects methods that call another class's methods far more often than * their own class's — a sign that the method "envies" the other class * and should probably be moved there. * * Detection strategy: * 1. For each method in each class, collect all call sites in its line range. * 2. Separate calls into: * internal — receiver is 'this' / 'self' / null (own class) * external — receiver_type != own class name (other classes) * 3. Find the external type with the most calls (external_max). * 4. Emit a note when: * external_max >= 4 (at least 4 calls to another class) * AND * external_max > internal + 2 (clearly prefers the other class) * * Languages: Java, TypeScript, Python. Bash / Rust — skipped. */ import type { AnalysisPass, PassContext } from '../../graph/analysis-pass.js'; export interface FeatureEnvyResult { envyMethods: Array<{ className: string; methodName: string; line: number; enviedClass: string; externalCalls: number; internalCalls: number; }>; } export declare class FeatureEnvyPass implements AnalysisPass { readonly name = "feature-envy"; readonly category: "architecture"; run(ctx: PassContext): FeatureEnvyResult; } //# sourceMappingURL=feature-envy-pass.d.ts.map