refactor: eliminate respond_to? violations, add thorough specs#85
Merged
Conversation
…o UmlModel - Remove 6 respond_to? calls across parser_pipeline, parsing, ea_root, index - Add build_index no-op to base Root (OCP: pipeline calls unconditionally) - Abstract classes define root_tag returning nil (replaces respond_to? check) - Replace respond_to?(:read) with is_a?(String) type check - Add id attribute to UmlModel (model-driven: UML Model can have xmi:id) - Remove respond_to?(:packaged_element) guard (Profile always has it)
- New namespace_detector_spec: regex extraction, version detection, regex vs Nokogiri parity across all fixtures - Rewritten index_spec: concrete assertions against known fixture data, EAStub indexing (commit b2593bd), parent tracking, minimal XML edge case - Extended parser_pipeline_spec: step isolation, context mutation, base Root compatibility - Extended extension_loading_spec: abstract vs stereotype root_tag tests - Extended versioning_spec: fallback idempotency, detect_register, parse_with_detected_version - Remove stale ea-xmi-2.4.2.xmi from fixture registry 248 -> 299 examples, 0 failures
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
respond_to?violations — 6 occurrences replaced with proper type checks, no-op base methods, and model-driven declarationsidtoUmlModel— UML Model elements CAN havexmi:idin XMI schema; now properly declaredCode changes
parser_pipeline.rbrespond_to?(:valid_encoding?)andrespond_to?(:build_index)root.rbbuild_index(OCP: pipeline calls unconditionally)parsing.rbrespond_to?(:read)withis_a?(String)ea_root/code_generation.rbroot_tag { nil }ea_root/extension_lifecycle.rbklass.root_tagtruthiness instead ofrespond_to?uml/uml_model.rbidattribute and mappingsparx/index.rbrespond_to?(:id)andrespond_to?(:packaged_element)guardsSpec additions
namespace_detector_spec.rb(new): regex extraction, version detection, regex vs Nokogiri parity across all fixturesindex_spec.rb(rewritten): concrete assertions against known fixture data, EAStub indexing, parent tracking, minimal XML edge caseparser_pipeline_spec.rb: step isolation, context mutation verification, base Root compatibilityextension_loading_spec.rb: abstract vs stereotyperoot_tagtestsversioning_spec.rb: fallback idempotency guard,detect_register,parse_with_detected_versionfixtures.rb: remove staleea-xmi-2.4.2.xmientry (file doesn't exist)