Refactor PDF Generator Service Methods#364
Open
stefan-burke wants to merge 3 commits intomainfrom
Open
Conversation
Extract long methods into smaller, focused helper methods across all PDF generator service files. All methods now comply with the 20-line maximum length standard while maintaining functionality. Changes: - table_builder.rb: Extract dimension building and inspector text logic - disclaimer_footer_renderer.rb: Split footer rendering into components - utilities.rb: Break watermark grid rendering into discrete steps - debug_info_renderer.rb: Separate header, summary, and table rendering - header_generator.rb: Extract unit header and expiry text rendering - image_processor.rb: Split photo dimension calculation logic - position_calculator.rb: Extract constraint fitting logic - assessment_block_builder.rb: Split build method into helper methods - assessment_block_renderer.rb: Extract fragment rendering helpers - assessment_columns.rb: Separate column placement and content rendering - pdf_generator_service.rb: Extract header, footer, and overlay logic All files verified with Ruby syntax checker. Full test suite requires libvips system dependency (not available in current environment). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Split method calls with more than 2 parameters across multiple lines for better readability. Fixed date format string to use I18n. Changes: - Split multi-parameter method definitions and calls - Fixed hardcoded date format string in utilities.rb - Added date.formats.pdf to en.yml for I18n compliance - Improved code formatting in header_generator.rb - Improved code formatting in disclaimer_footer_renderer.rb - Improved code formatting in image_processor.rb - Extracted generate_inspection_report_content helper method Note: pdf_generator_service.rb still has some line length violations that need additional refactoring to fix completely. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Updated test stubs to use Rails.configuration.pdf.logo instead of ENV["PDF_LOGO"] because the PdfConfig object is created at Rails startup from ENV and stubbing ENV in tests doesn't affect it. This fixes the failing test that expected 3 make_cell calls when both signature and logo are present. All 14 examples now pass. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
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.
No description provided.