Skip to content

Commit

Permalink
Change Style/HashSyntax configuration (#59)
Browse files Browse the repository at this point in the history
This change allows for the use of either pre-Ruby 3.1 hash syntax or the
newer shorthand value omission style, so long as the use is consistent.

As such, the change to this configuration is likely non-breaking and
shouldn't introduce a pile of errors in existing code.

> ```ruby
> # bad - `bar` value can be omitted
> {foo:, bar: bar}
>
> # bad - mixed syntaxes
> {foo:, bar: baz}
>
> # good - `foo` and `bar` values can be omitted, but they are
> # consistent, so it's accepted
> {foo: foo, bar: bar}
>
> # good
> {foo:, bar:}
>
> # good - can't omit `baz`
> {foo: foo, bar: baz}
> ```
  • Loading branch information
jgarber623-cargosense authored Aug 2, 2024
2 parents d341c1f + 408ccf5 commit 3475cb7
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ PATH
remote: .
specs:
rubocop-cargosense (2.0.0)
rubocop (~> 1.61)
rubocop (~> 1.64)
rubocop-capybara (~> 2.20)
rubocop-factory_bot (~> 2.26.1)
rubocop-performance (~> 1.20)
Expand Down
2 changes: 1 addition & 1 deletion config/rubocop-style.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Style/EmptyMethod:
EnforcedStyle: expanded

Style/HashSyntax:
EnforcedShorthandSyntax: never
EnforcedShorthandSyntax: either_consistent

Style/MethodCalledOnDoEndBlock:
Enabled: true
Expand Down
2 changes: 1 addition & 1 deletion rubocop-cargosense.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Gem::Specification.new do |spec|
"source_code_uri" => "#{spec.homepage}/tree/v#{spec.version}"
}

spec.add_dependency "rubocop", "~> 1.61"
spec.add_dependency "rubocop", "~> 1.64"
spec.add_dependency "rubocop-capybara", "~> 2.20"
spec.add_dependency "rubocop-factory_bot", "~> 2.26.1"
spec.add_dependency "rubocop-performance", "~> 1.20"
Expand Down

0 comments on commit 3475cb7

Please sign in to comment.