From ec979fe7cbc64a6894c38e491f1ee4d37584ff82 Mon Sep 17 00:00:00 2001 From: Douglas Eichelberger Date: Fri, 19 Jan 2024 13:54:52 -0800 Subject: [PATCH] Replace Rails/NegateInclude with Inverse/Invertible cops --- Library/.rubocop.yml | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/Library/.rubocop.yml b/Library/.rubocop.yml index e2b47c651df9a2..e7194a9b6b4d10 100644 --- a/Library/.rubocop.yml +++ b/Library/.rubocop.yml @@ -213,8 +213,6 @@ Rails/Blank: Enabled: true Rails/CompactBlank: Enabled: true -Rails/NegateInclude: - Enabled: true Rails/Presence: Enabled: true Rails/Present: @@ -354,15 +352,30 @@ Style/HashAsLastArrayItem: - "/**/Formula/**/*.rb" - "**/Formula/**/*.rb" +Style/InverseMethods: + Exclude: + # `exclude?` is not available everywhere + - "Homebrew/rubocops/**/*.rb" + - "Homebrew/sorbet/tapioca/require.rb" + - "Homebrew/standalone/init.rb" + InverseMethods: + :include?: :exclude? + :exclude?: :include? + Style/InvertibleUnlessCondition: Enabled: true + Exclude: + # `exclude?` is not available everywhere + - "Homebrew/rubocops/**/*.rb" + - "Homebrew/sorbet/tapioca/require.rb" + - "Homebrew/standalone/init.rb" InverseMethods: # Favor `if a != b` over `unless a == b` :==: :!= # Unset this (prefer `unless a.zero?` over `if a.nonzero?`) :zero?: - # Don't require non-standard `exclude?` (for now at least) - it's not available in every file - :include?: + :include?: :exclude? + :exclude?: :include? Style/MutableConstant: # would rather freeze too much than too little