You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Enable RuboCop EnforcedShorthandSyntax: always and autocorrect the codebase #2833
Our RuboCop config enables Style/HashSyntax but leaves EnforcedShorthandSyntax at the default either, which accepts both styles. During review of #2832 this came up: when a hash keyword matches a same-named local variable or method, the idiomatic modern Ruby (3.1+) form is shorthand — write member: instead of member: member.
# shorthand: key name matches the variable/method namedescribed_class.with(member:).chaser.deliver_nowFabricate(:subscription,member:,group: students_group)# longhand stays: value is an expression or differently-named variableFabricate(:member_email_delivery,member:,email_type: action_name)
Enforcing it mechanically means reviewer preferences no longer need to be remembered — the linter carries the rule.
Size: with EnforcedShorthandSyntax: always, the current codebase produces 466 offenses across 367 files — every single one autocorrectable.
Steps to fix 🛠
In .rubocop.yml, set the option on the existing cop:
Style/HashSyntax:
EnforcedShorthandSyntax: always
Run the sweep — all offenses are marked [Correctable]:
bundle exec rubocop -a
No .rubocop_todo.yml entry is needed: the sweep fixes the whole backlog, so nothing is deferred.
To do 📋
Claim this issue (comment below, or assign yourself if you are part of the codebar org)
Fork and clone the repository
Update the relevant files. Follow the steps to fix section in this issue.
Commit your changes as one commit. Use the title of this issue as your commit message
Submit a pull request
Mention this issue in the PR description by including it's number
Have your pull request reviewed & merged by a codebar team member
Activity