Extract xmltype_argument? and tmp_table_argument? predicates#295
Merged
Conversation
`argument_metadata[:type_name] == "XMLTYPE" || argument_metadata[:data_type] =~ /XMLTYPE/` appeared verbatim in `add_argument`, `add_return_variable`, and `return_variable_value`. The shorter `argument_metadata[:tmp_table_name]` presence check also appeared in the same three dispatchers. Collapse each into a single private predicate so the rule lives in one place. No behavior change. Full suite is green (468 examples, 0 failures, 1 pre-existing pending). This is a targeted predicate extraction, not a structural refactor of the three `case argument_metadata[:data_type]` dispatchers; those remain as before. Co-Authored-By: Claude Opus 4.7 (1M context) <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.
Summary
Two identical conditions appeared verbatim in three sibling dispatchers in
ProcedureCall:argument_metadata[:type_name] == "XMLTYPE" || argument_metadata[:data_type] =~ /XMLTYPE/— atadd_argument,add_return_variable, andreturn_variable_valueargument_metadata[:tmp_table_name](presence check guarding the "TABLE / PL/SQL TABLE type defined inside package" branch) — same three sitesCollapse each into a single private predicate (
xmltype_argument?,tmp_table_argument?) so the rule lives in one place. The longest line in the affected dispatchers (~88 chars) becomes a 35-char predicate call.Scope
This is intentionally narrow. The three
case argument_metadata[:data_type]dispatchers themselves are not restructured — a broader Strategy-style refactor was considered and rejected for this PR because the lines-of-code cost did not pay for the structural change. Only the verbatim duplications are removed here.Diff stat:
lib/plsql/procedure_call.rb | 20 ++++++++++++++------(+14 / -6).Test plan
bundle exec rspec— 468 examples, 0 failures, 1 pre-existing pending (Oracle 9.2 indexed-by-binary-integer skip)ruby -c lib/plsql/procedure_call.rbpassesargument_metadata[:tmp_table_name]presence check (string interpolations of:tmp_table_namein generated SQL are out of scope and remain)🤖 Generated with Claude Code