refactor: eliminate require_relative in cli and public_send from lib - #32
Open
ronaldtse wants to merge 5 commits into
Open
refactor: eliminate require_relative in cli and public_send from lib#32ronaldtse wants to merge 5 commits into
ronaldtse wants to merge 5 commits into
Conversation
TODO 03: Remove 13 require_relative lines from cli/main.rb. All CLI classes are autoloaded from lib/uniword.rb (parent namespace file). TODO 05: Eliminate 5 of 8 public_send sites in lib/: - has_borders.rb: case/when for border sides (top/bottom/left/right/between/bar) - warning_collector.rb: case/when for log levels (debug/info/warn/error) - theme_processor.rb: use color_scheme.color_by_name(attr) - theme_transformation.rb: use word_colors.color_by_name(key) - footnote_reference_checker.rb: case/when for footnotes/endnotes Also made ColorScheme#color_by_name public (was private). TODO 12: Documented 3 remaining public_send sites as legitimate dynamic dispatch: - variable_resolver.rb: template property access on arbitrary objects - element_serializer.rb: schema-driven serialization over Serializable 5460 specs pass, 0 failures.
TODO 04: Eliminated 23 of 30 instance_variable_set/get sites across 11 spec files. Each replaced with the public setter/reader: - comments_part_spec, comment_spec, tracked_changes_spec: use lutaml-model public setters (comment_id=, author=, revision_id=) - comment_range_spec: use attr_accessor marker_type= - paragraph_validator_spec, table_validator_spec: use public setters (properties=, runs=, rows=) - link_validator_spec: use bookmarks= setter - run_builder_spec: use model.drawings instead of ivar_get - image_embedding_spec: use new attr_reader :show_legend, :width, :height on ChartBuilder - document_context_spec: use new attr_reader :parsed_parts Remaining 7 sites are legitimate test infrastructure: - 6 in zip_extractor_spec (Tempfile @Finalizer manipulation — external stdlib) - 1 in element_validator_spec (class-level registry save/restore)
…ility specs
TODO 02 (partial): Replaced 5 of 65 double() calls:
- element_spec: RecordingVisitor class instead of double('visitor')
- accessibility_rule_spec: real DocumentRoot/Paragraph instead of
double('Document')/double('Element')
Remaining 60 doubles are in larger files (word_css_spec 14,
image_alt_text_rule_spec 12, math_equation/plurimath 7 each)
that need per-test analysis.
…lity spec
TODO 02 (partial): 3 more doubles replaced:
- accessibility_checker_spec: real DocumentRoot.new instead of
double('Document') with stubbed images/tables/paragraphs
Total doubles remaining: 59
…_spec TODO 02 (partial): 4 more doubles replaced with real Drawing/Paragraph instances. Total fixed: 10 of 65.
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.
Summary
Completes TODO 03, 05, and 12 from the consolidated TODO/ backlog.
require_relativelines fromcli/main.rb. All CLI classes are autoloaded fromlib/uniword.rb.public_sendsites via case/when dispatch or existingcolor_by_nameaccessor. MadeColorScheme#color_by_namepublic.public_sendsites as legitimate dynamic dispatch (template property access, schema-driven serialization).Test plan