From ce9cc0f8b41abc667021719583c534b9e258a044 Mon Sep 17 00:00:00 2001 From: Holger Just Date: Sat, 5 Aug 2017 18:44:47 +0200 Subject: [PATCH] Disable RuboCop check for conditional assignment It is not universally useful to enfore a single assignment mode. With short conditionals (or even a ternary operator), an assignment of the returned value is common. For longer or more complex conditionals, I perfer an assignment inside the condition to decouple the conditional checks from the assignment logic. --- .rubocop.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.rubocop.yml b/.rubocop.yml index 284099d..25ac3be 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -51,6 +51,12 @@ Style/Copyright: Style/CaseEquality: Enabled: false +# Both styles (i.e. assigning the return falue of a conditional once or +# assigning explicitly inside the conditional) have their place, dependent on +# the complexity. Enforcing a single style doesn't make the code any clearer. +Style/ConditionalAssignment: + Enabled: false + # Double negation is fine to reliably produce a Boolean from any value. Style/DoubleNegation: Enabled: false