From 2afe12ee1e6d82c7b3689adf63962bb986f69b31 Mon Sep 17 00:00:00 2001 From: Ewoud Kohl van Wijngaarden Date: Thu, 13 Jul 2023 15:55:04 +0200 Subject: [PATCH] Enforce require_parentheses_when_complex style for ternaries From the cops documentation for the good style: ```ruby foo = bar? ? a : b foo = bar.baz? ? a : b foo = (bar && baz) ? a : b ``` --- rubocop.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/rubocop.yml b/rubocop.yml index 25c89dc..d24769d 100644 --- a/rubocop.yml +++ b/rubocop.yml @@ -23,6 +23,9 @@ Gemspec/RequireMFA: Gemspec/DevelopmentDependencies: Enabled: false +Style/TernaryParentheses: + EnforcedStyle: require_parentheses_when_complex + Style/TrailingCommaInHashLiteral: Enabled: True EnforcedStyleForMultiline: consistent_comma