Style/HashSyntax: Set EnforcedShorthandSyntax to `either_consistent`
What does this MR do and why?
Examples:
# good - `foo` and `bar` values can be omitted, but they are consistent, so it's accepted
{foo: foo, bar: bar}
# bad - `bar` value can be omitted
{foo:, bar: bar}
# bad - mixed syntaxes
{foo:, bar: baz}
# good
{foo:, bar:}
# good - can't omit `baz`
{foo: foo, bar: baz}
See also gitlab-org/gitlab!161622 (merged)
Config diff rubocop --show-cops
--- before 2024-10-29 10:48:45.024558411 +0100
+++ after 2024-10-29 10:46:27.510401588 +0100
@@ -5374,7 +5374,7 @@
- hash_rockets
- no_mixed_keys
- ruby19_no_mixed_keys
- EnforcedShorthandSyntax: never
+ EnforcedShorthandSyntax: either_consistent
SupportedShorthandSyntax:
- always
- never
`'`
Edited by Peter Leitzen