Repository navigation
refactor: convert option-hash parameters to keyword arguments - #3012
Merged
mroderick merged 4 commits intoOct 12, 2026
Merged
Conversation
Call sites already pass name: and chapter:. The signature now says so, and a misspelled key raises ArgumentError instead of passing silently through an options hash. Issue codebar#3009.
mroderick
force-pushed
the
style/kwargs-over-option-hashes
branch
from
October 12, 2026 14:59
8b2841f to
0d5562e
Compare
mroderick
added a commit
to mroderick/codebar-planner
that referenced
this pull request
Oct 12, 2026
The keyword conversion made both constructor arguments optional, so Verifier.new() succeeded where the old required positional hash raised ArgumentError. The guard restores failure at construction and keeps both call sites (Verifier.new(token:) in members_controller, Verifier.new(id:) in application_helper) working. Review finding on PR codebar#3012. Issue codebar#3009.
Call sites already pass id: and token: as keywords, so the signature now states the real contract. A positional options hash now raises ArgumentError. Construction with neither id nor token also raises, keeping the fail-fast guarantee the old required positional hash gave. Issue codebar#3009.
All four call sites pass the argument. Issue codebar#3009.
Encodes the keyword-arguments-over-option-hashes preference from the PR codebar#3003 review for code written from now on. Issue codebar#3009.
mroderick
force-pushed
the
style/kwargs-over-option-hashes
branch
from
October 12, 2026 16:22
64954a1 to
a65e0c9
Compare
mroderick
marked this pull request as ready for review
October 12, 2026 16:22
mroderick
force-pushed
the
style/kwargs-over-option-hashes
branch
from
October 12, 2026 16:22
64954a1 to
a65e0c9
Compare
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.
Converts the signatures listed in #3009 to keyword arguments and enables the RuboCop cop that enforces the preference from now on.
SponsorsSearchtakesname:andchapter:keywords instead of an options hash. The admin sponsors controller splats its existing{ name:, chapter: }hash into the new signature.Verifiertakesid:andtoken:keywords and rejects construction with neither. Both call sites already called it that way; the signature now says so, and a misspelled key raisesArgumentErrorinstead of passing silently.grant_organiser_accessin the meetings, events, and workshops controllers drops its unused= []default.Style/OptionHashis enabled in.rubocop.yml. It matches option-hash parameters by name and has no autocorrect.Closes #3009
Review notes
Resolved:
Verifier#initializenow raisesArgumentErrorwhen constructed with neitheridnortoken, restoring the old constructor's fail-fast behaviour while keeping both call sites (Verifier.new(token:),Verifier.new(id:)) working.Also risky: the
**search_paramssplat is the only call-site change (it assumes the hash carries exactlynameandchapter).Deliberately not done: no shared concern for the three
grant_organiser_accesscopies (the issue lists that as a review step), and the excluded wrappers (number_to_currency,title,avatar,sponsors?) stay as they are.