Skip to content

Refactor analyzers and report builder helpers#5

Merged
pixge merged 1 commit intocodex/modify-scaffolding-and-implement-loggingfrom
codex/refactor-analyzers-and-report-builder
Jan 11, 2026
Merged

Refactor analyzers and report builder helpers#5
pixge merged 1 commit intocodex/modify-scaffolding-and-implement-loggingfrom
codex/refactor-analyzers-and-report-builder

Conversation

@pixge
Copy link
Owner

@pixge pixge commented Jan 11, 2026

Motivation

  • Improve separation of concerns in analyzers by splitting analyze_file into focused helper methods for parsing, unit collection, metric extraction and result construction.
  • Make the indirection analysis clearer by isolating function definition collection, alias resolution, call-graph construction and depth calculation.
  • Simplify ReportBuilder.build by extracting per-file analysis, per-file report assembly and summary construction to helpers for readability and testability.
  • Enable unit-testing of small pieces of logic by exposing internal helpers without changing external behavior.

Description

  • Added helper methods to BpsAnalyzer (_parse_file, _collect_units, _collect_bps, _build_results) and rewrote analyze_file to use them.
  • Added helper methods to CsaAnalyzer (_parse_file, _collect_module_symbols, _collect_unit_nodes, _extract_external_symbols, _build_results) and rewrote analyze_file accordingly.
  • Added helper methods to IndirectionAnalyzer (_parse_file, _collect_function_definitions, _collect_aliases, _collect_call_graph, _calculate_indirection_depths) and refactored analyze_file to use them.
  • Refactored ReportBuilder to extract _collect_file_analysis, _build_file_report and _build_summary, added result type imports, and added tests/test_analyzers.py with helper-focused tests.

Testing

  • Ran the test suite with python -m unittest discover -s tests which executed the tests and reported Ran 12 tests with an OK result.
  • Also executed python -m unittest and python -m unittest discover during development; discovery run produced no tests outside the tests directory and did not fail.
  • The new tests/test_analyzers.py file contains unit tests that exercise the new helper methods for BPS, CSA, indirection and report-builder helpers and passed under the test discovery run.
  • No automated tests failed as part of these runs.

Codex Task

@pixge pixge merged commit dac6098 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