Skip to content

[Detection] Factory-with-arguments in extractFactoryCallAssignments (A5 follow-up) #115

Description

@AndresL230

Summary

PR #110's A5 factory pattern recognition handles const c = makeClient() but does NOT handle const c = makeClient(config) — the regex extractFactoryCallAssignments matches no-arg calls only.

Current behavior

// works (resolved):
const client = makeClient();

// not resolved:
const client = makeClient(config);
const client = makeClient({ apiKey: process.env.KEY });
const client = makeClient(env, options);

What to do

  • Update extractFactoryCallAssignments in src/ast/cross-file-resolver.ts to match factory calls with any argument count.
  • AST-based match is preferable to a wider regex — the existing pattern looks for \bmake[A-Z]\w*\s*\(\s*\) shape; widen to \(\s*[^)]*\s*\) or use the AST call_expression node directly.
  • Audit fixture demonstrating zero-arg, single-arg, and multi-arg factories.
  • Test ensuring each variant resolves to the factory's factoryReturnMap entry.

Acceptance criteria

Reference

Memory: a3_a5_pr_status.md — "Factory with arguments (const c = makeClient(config)) — extractFactoryCallAssignments matches no-arg calls only."

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/detectiondocs/accuracy/detection.md — finding every call site, attributing correctlyenhancementNew feature or requestwave/3-resolver-followupsA3/A5 incremental fixes: default-import threading, factory-with-args, images.generate narrowing

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions