Skip to content

48 chore refactor codebase and add developer documentation - #49

Merged
SizzleUnrlsd merged 19 commits into
mainfrom
48-chore-refactor-codebase-and-add-developer-documentation
Feb 26, 2026
Merged

48 chore refactor codebase and add developer documentation#49
SizzleUnrlsd merged 19 commits into
mainfrom
48-chore-refactor-codebase-and-add-developer-documentation

Conversation

@SizzleUnrlsd

Copy link
Copy Markdown
Contributor

Context

This PR refactors the project architecture to move core logic out of main, improve maintainability, and add finer-grained module tests while preserving existing CLI behavior.

What Changed

  • Orchestration refactor
    • Introduced AnalyzerApp as an application-layer orchestrator.
    • Introduced a reusable ArgParser (usable from CLI and library consumers).
    • Introduced modular analyzer components:
      • AnalysisPipeline
      • ModulePreparationService
      • DiagnosticEmitter
      • LocationResolver
  • New analysis module
    • Added Reachability for classifying statically unreachable stack-access findings.
  • main simplification
    • main.cpp now delegates to parser + app service.
  • Logging cleanup
    • Migrated multiple analysis/pass traces to coretrace::logger for consistency.
  • Library consumer example
    • Updated extern-project to demonstrate argument forwarding in library mode.
  • Unit testing
    • Added fine-grained C++ module unit tests (stack_usage_analyzer_unit_tests) for:
      • LocationResolver
      • Reachability
      • ModulePreparationService
    • Unit-test binary is now opt-in via CMake:
      • -DBUILD_ANALYZER_UNIT_TESTS=ON
  • run_test.py improvements
    • Expanded CLI option matrix coverage.
    • Added diagnostic rule coverage regression checks.
    • Integrated analyzer module unit-test execution when binary is present.
    • Graceful skip when unit-test binary is not built.
    • Excluded test/unit/* from integration fixture scans.
  • Documentation
    • Added architecture doc for analyzer modules.
    • Updated root README (library-mode argument forwarding + architecture reference).
    • Added extern-project/README.
  • CI
    • Added a consumer-fixture integration job validating JSON/SARIF outputs.

Architectural Rationale

This split enforces clear boundaries between:

  • argument parsing/validation,
  • application orchestration,
  • analysis pipeline execution,
  • diagnostic emission.

The result is lower coupling, better testability, and safer future evolution with reduced regression risk.

Compatibility

  • CLI behavior remains functionally consistent.
  • Analyzer module unit tests are now opt-in:
    • -DBUILD_ANALYZER_UNIT_TESTS=ON
  • No expected breaking change for users consuming only the main analyzer binary.

Validation

  • Main project build
  • extern-project build
  • Regression suite (run_test.py)
  • Analyzer module unit tests: (when enabled)

Reviewer Notes

  • Changes are split into atomic commits (CLI/app/main/analyzer/tests/docs/CI).
  • Local untracked file analyse is intentionally excluded from this PR.

@SizzleUnrlsd SizzleUnrlsd self-assigned this Feb 25, 2026
@SizzleUnrlsd SizzleUnrlsd linked an issue Feb 25, 2026 that may be closed by this pull request
14 tasks

@github-advanced-security github-advanced-security AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

coretrace-stack-analyzer found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.

@SizzleUnrlsd
SizzleUnrlsd merged commit 8e0809b into main Feb 26, 2026
9 of 10 checks passed
@SizzleUnrlsd
SizzleUnrlsd deleted the 48-chore-refactor-codebase-and-add-developer-documentation branch February 26, 2026 06:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

chore: Refactor codebase and add developer documentation

2 participants