Skip to content

Refactor indirection analysis helpers#10

Merged
pixge merged 1 commit intocodex/modify-scaffolding-and-implement-loggingfrom
codex/refactor-low-bps-units-functions
Jan 11, 2026
Merged

Refactor indirection analysis helpers#10
pixge merged 1 commit intocodex/modify-scaffolding-and-implement-loggingfrom
codex/refactor-low-bps-units-functions

Conversation

@pixge
Copy link
Owner

@pixge pixge commented Jan 11, 2026

Motivation

  • The IndirectionAnalyzer.analyze_file function had many conditionals and responsibilities, making it hard to read and maintain.
  • Breaking the logic into smaller helpers reduces per-unit complexity and centralizes alias/call resolution behavior.
  • Helper methods make it easier to reason about self-call resolution, alias caching, and ignorable call checks.

Description

  • Split the main analysis flow into focused helpers: _collect_builtin_names, _collect_stdlib_modules, and _collect_unit_calls to encapsulate environment and call collection steps.
  • Introduced _build_results, _class_context, _resolve_unit_calls, _resolve_self_call, and _is_ignorable_call to handle per-unit call resolution and result construction.
  • Kept existing alias caching and call_graph computation via the existing _resolve_alias and _collect_call_graph logic, and replaced inline logic with calls to the new helpers.
  • Regenerated report.json to reflect updated metrics after the refactor.

Testing

  • Ran the CLI analysis command python3 -m codra.cli.main /workspace/codra --output /workspace/codra/report.json and it completed successfully with the report written to /workspace/codra/report.json.
  • No automated unit tests were modified or explicitly run as part of this change.

Codex Task

@pixge pixge merged commit 1b94399 into codex/modify-scaffolding-and-implement-logging Jan 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant