Skip to content

Commit

Permalink
Enforce require_parentheses_when_complex style for ternaries
Browse files Browse the repository at this point in the history
From the cops documentation for the good style:

```ruby
foo = bar? ? a : b
foo = bar.baz? ? a : b
foo = (bar && baz) ? a : b
```
  • Loading branch information
ekohl committed Jul 13, 2023
1 parent 0261257 commit 2afe12e
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ Gemspec/RequireMFA:
Gemspec/DevelopmentDependencies:
Enabled: false

Style/TernaryParentheses:
EnforcedStyle: require_parentheses_when_complex

Style/TrailingCommaInHashLiteral:
Enabled: True
EnforcedStyleForMultiline: consistent_comma
Expand Down

0 comments on commit 2afe12e

Please sign in to comment.