Refactor report.py: Extract common helpers, eliminate duplication#12
Merged
Refactor report.py: Extract common helpers, eliminate duplication#12
Conversation
Co-authored-by: Kilynho <40294264+Kilynho@users.noreply.github.com>
Co-authored-by: Kilynho <40294264+Kilynho@users.noreply.github.com>
Co-authored-by: Kilynho <40294264+Kilynho@users.noreply.github.com>
Co-authored-by: Kilynho <40294264+Kilynho@users.noreply.github.com>
Co-authored-by: Kilynho <40294264+Kilynho@users.noreply.github.com>
Co-authored-by: Kilynho <40294264+Kilynho@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Refactor report.py for cleaner output management
Refactor report.py: Extract common helpers, eliminate duplication
Dec 8, 2025
Owner
|
@copilot I want to merge it to develop branch |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
report.pycontained significant code duplication across analyzer, autofix, and compile report generators. Identical logic for timestamps, HTML escaping, diff formatting, and table generation was repeated in 8+ places, making maintenance error-prone.Changes
Common Helpers Extracted (10 functions)
_format_timestamp(),_escape_html(),_safe_id(),_generate_html_header()_format_diff_html(),_get_diff(),_colorize_checkpatch_output(),_generate_percentage_bar()_generate_table_row_with_bars(),_generate_reason_table_section()Before/After Example
Refactored Functions
All 8 HTML generators now use common helpers:
generate_html_report()- Eliminated localwrite_reason_table()generate_analyzer_html()- Uses_generate_html_header()generate_detail_*_html()- Uses_safe_id(),_colorize_checkpatch_output()generate_autofix_*_html()- Optimized diff processinggenerate_compile_html()- Consistent header generationCode Quality
_generate_table_row_with_bars()split()calls in diff processingImpact
Documentation
REFACTORING_REPORT.md- Technical details, patterns, metricsREFACTORING_SUMMARY.md- Executive summarySecurity
✅ CodeQL scan: 0 alerts
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.