Skip to content

Use Ruby 3.1 shorthand kwargs syntax#2671

Open
ericproulx wants to merge 2 commits intomasterfrom
ruby_3_1_shorthand_kwargs
Open

Use Ruby 3.1 shorthand kwargs syntax#2671
ericproulx wants to merge 2 commits intomasterfrom
ruby_3_1_shorthand_kwargs

Conversation

@ericproulx
Copy link
Copy Markdown
Contributor

@ericproulx ericproulx commented Apr 3, 2026

Summary

  • Replace redundant `key: key` kwargs with the shorthand `key:` form (Ruby 3.1+) across lib and spec files
  • Enforce the style going forward via a new RuboCop rule in `.rubocop.yml`
  • Pure readability improvement — no behavior change

Test plan

  • `bundle exec rspec` passes
  • `bundle exec rubocop` passes

🤖 Generated with Claude Code

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 3, 2026

Danger Report

No issues found.

View run

@ericproulx ericproulx force-pushed the ruby_3_1_shorthand_kwargs branch 2 times, most recently from f3db28a to 166d459 Compare April 3, 2026 16:48
Replace five specific exception classes (EmptyMessageBody, TooManyMultipartFiles,
TooDeepParameters, ConflictingTypes, InvalidParameters) with a single
Grape::Exceptions::RequestError that forwards the Rack exception message directly.

On Rack 3.1.0, a single `rescue Rack::BadRequest` covers all bad-request errors via
the marker module. Before, each exception class is listed explicitly in
Grape::RACK_ERRORS.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@ericproulx ericproulx force-pushed the ruby_3_1_shorthand_kwargs branch from 166d459 to 97bbc0f Compare April 5, 2026 21:47
Replace redundant `key: key` kwargs with the shorthand `key:` form
where the local variable name matches the keyword argument name.

Enforce the style through Rubocop

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@ericproulx ericproulx force-pushed the ruby_3_1_shorthand_kwargs branch from 97bbc0f to f99f2e8 Compare April 5, 2026 22:04
@ericproulx ericproulx requested a review from dblock April 5, 2026 22:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants