Skip to content
This repository has been archived by the owner on Jul 19, 2024. It is now read-only.

Commit

Permalink
Disable EnforcedShorthandSyntax in Style/HashSyntax
Browse files Browse the repository at this point in the history
We should not be forcing the shorthand syntax because of a few reasons:

1. That syntax doesn't always yields the best/clear code. It has
surprising behavior specially with method calls using the key names.
2. Ruby 3.1 shorthand syntax is still not supported by Sorbet.

We can fix 2, but not 1, so it is better to just allow people to chose
when to use the shorthand syntax in the context that makes sense.
  • Loading branch information
rafaelfranca committed Mar 2, 2022
1 parent febfda9 commit c1c0530
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,9 @@ Style/HashExcept:
Style/HashLikeCase:
Enabled: false

Style/HashSyntax:
EnforcedShorthandSyntax: either

Style/HashTransformKeys:
Enabled: false

Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/full_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2718,7 +2718,7 @@ Style/HashSyntax:
- hash_rockets
- no_mixed_keys
- ruby19_no_mixed_keys
EnforcedShorthandSyntax: always
EnforcedShorthandSyntax: either
SupportedShorthandSyntax:
- always
- never
Expand Down

0 comments on commit c1c0530

Please sign in to comment.