update_ruby_recipe: use spaceship operator for sorting versions#53
Conversation
📝 WalkthroughWalkthroughThe change modifies a single comparison expression in the ChangesInsertion Ordering Fix
Estimated code review effort: 1 (Trivial) | ~2 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Greptile SummaryFixes a
Confidence Score: 5/5Safe to merge — the one-line change correctly resolves the crash and the rest of the script is unchanged. The fix is a minimal, targeted correction for a well-understood NoMethodError. The spaceship operator is defined on Array and produces the right ordering semantics for the nested arrays returned by version_sort_key. No other code paths are affected. No files require special attention. Important Files Changed
Reviews (1): Last reviewed commit: "update_ruby_recipe: use spaceship operat..." | Re-trigger Greptile |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
libexec/update_ruby_recipe.rb (1)
68-68: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueApply RuboCop-suggested style fix.
RuboCop flags
Style/NumericPredicate(prefer.positive?over> 0) andLayout/LineLength(133/118) for this line.♻️ Proposed fix
- insert_at = blocks.find { |block| (version_sort_key(block.fetch(:version)) <=> version_sort_key(`@version`)) > 0 }&.fetch(:start) + insert_at = blocks.find do |block| + (version_sort_key(block.fetch(:version)) <=> version_sort_key(`@version`)).positive? + end&.fetch(:start)🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@libexec/update_ruby_recipe.rb` at line 68, Update the block selection in update_ruby_recipe.rb to satisfy RuboCop by replacing the numeric comparison in the insert_at assignment with a predicate-based check, using the existing version_sort_key, blocks, and `@version` logic in the same expression. Keep the line within the style length limit by breaking the chained call across lines or refactoring the expression for readability without changing behavior.Source: Linters/SAST tools
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@libexec/update_ruby_recipe.rb`:
- Line 68: Update the block selection in update_ruby_recipe.rb to satisfy
RuboCop by replacing the numeric comparison in the insert_at assignment with a
predicate-based check, using the existing version_sort_key, blocks, and `@version`
logic in the same expression. Keep the line within the style length limit by
breaking the chained call across lines or refactoring the expression for
readability without changing behavior.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Central YAML (base), Organization UI (inherited)
Review profile: CHILL
Plan: Pro Plus
Run ID: 2bd10ed1-e393-436e-8a4b-a753905aacba
📒 Files selected for processing (1)
libexec/update_ruby_recipe.rb
|
@jdx can you merge this PR? That'll allow us to use the |
Arraydoes not includeComparable, so>on the nested arrays returned by#version_sort_keyraisedNoMethodError. This was introduced via 335de38 on #48.This causing the autobump workflow to fail with the
3.4.10release.Summary by CodeRabbit