Skip to content

Commit c1c0530

Browse files
committed
Disable EnforcedShorthandSyntax in Style/HashSyntax
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.
1 parent febfda9 commit c1c0530

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

rubocop.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -484,6 +484,9 @@ Style/HashExcept:
484484
Style/HashLikeCase:
485485
Enabled: false
486486

487+
Style/HashSyntax:
488+
EnforcedShorthandSyntax: either
489+
487490
Style/HashTransformKeys:
488491
Enabled: false
489492

test/fixtures/full_config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2718,7 +2718,7 @@ Style/HashSyntax:
27182718
- hash_rockets
27192719
- no_mixed_keys
27202720
- ruby19_no_mixed_keys
2721-
EnforcedShorthandSyntax: always
2721+
EnforcedShorthandSyntax: either
27222722
SupportedShorthandSyntax:
27232723
- always
27242724
- never

0 commit comments

Comments
 (0)