From cccbb5c705dceff5bad8d3e2c9d472b79000f423 Mon Sep 17 00:00:00 2001 From: Douglas Eichelberger Date: Tue, 18 Apr 2023 15:06:41 -0700 Subject: [PATCH] Enable Style/InvertibleUnlessCondition cop --- Library/.rubocop.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Library/.rubocop.yml b/Library/.rubocop.yml index 7cb07e6f70..373b06036e 100644 --- a/Library/.rubocop.yml +++ b/Library/.rubocop.yml @@ -373,6 +373,17 @@ Style/HashAsLastArrayItem: - "/**/Formula/**/*.rb" - "**/Formula/**/*.rb" +Style/InvertibleUnlessCondition: + inherit_mode: + override: + - InverseMethods + Enabled: true + InverseMethods: + # Favor `if a != b` over `unless a == b` + :==: :!= + # Unset this (prefer `unless a.zero?` over `if a.nonzero?`) + :zero?: + # would rather freeze too much than too little Style/MutableConstant: EnforcedStyle: strict