Skip to content

Decompose generate_pdf_report into section functions and add unit tests#31

Merged
bencehezso merged 1 commit into
mainfrom
task/refactor_report_pdf
May 12, 2026
Merged

Decompose generate_pdf_report into section functions and add unit tests#31
bencehezso merged 1 commit into
mainfrom
task/refactor_report_pdf

Conversation

@bencehezso
Copy link
Copy Markdown
Contributor

Decomposes the 630-line generate_pdf_report monolith in core/utils_report.py into individually testable section-building functions, and adds unit tests for each.

This PR extracts seven private build* functions (summary, scope, cost, risk, scoring, resource inventory, alternative technologies) that each return a list of ReportLab flowables, plus a shared _default_table_style() helper that replaces the duplicated table style definitions. The public generate_pdf_report function becomes a ~30-line orchestrator with an unchanged signature, so callers and PDF output are unaffected. A new tests/test_pdf_sections.py adds 25 unit tests covering each extracted function, edge cases (empty data, unknown providers), and the previously untested anonymize_string utility.

@bencehezso bencehezso self-assigned this May 12, 2026
@bencehezso bencehezso added the enhancement New feature or request label May 12, 2026
@bencehezso bencehezso merged commit 2fc01bf into main May 12, 2026
3 checks passed
@bencehezso bencehezso deleted the task/refactor_report_pdf branch May 12, 2026 15:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant