diff --git a/lib/rubocop/cop/layout/space_after_not.rb b/lib/rubocop/cop/layout/space_after_not.rb index 1f49efa13b1..1649587b376 100644 --- a/lib/rubocop/cop/layout/space_after_not.rb +++ b/lib/rubocop/cop/layout/space_after_not.rb @@ -16,6 +16,7 @@ class SpaceAfterNot < Base extend AutoCorrector MSG = 'Do not leave space between `!` and its argument.' + RESTRICT_ON_SEND = %i[!].freeze def on_send(node) return unless node.prefix_bang? && whitespace_after_operator?(node) diff --git a/lib/rubocop/cop/layout/space_before_brackets.rb b/lib/rubocop/cop/layout/space_before_brackets.rb index caa7be1460b..8bcb96a5cbe 100644 --- a/lib/rubocop/cop/layout/space_before_brackets.rb +++ b/lib/rubocop/cop/layout/space_before_brackets.rb @@ -19,6 +19,7 @@ class SpaceBeforeBrackets < Base extend AutoCorrector MSG = 'Remove the space before the opening brackets.' + RESTRICT_ON_SEND = %i[[] []=].freeze def on_send(node) return unless (first_argument = node.first_argument) diff --git a/lib/rubocop/cop/style/yoda_condition.rb b/lib/rubocop/cop/style/yoda_condition.rb index 8db3c56a118..2277242d31e 100644 --- a/lib/rubocop/cop/style/yoda_condition.rb +++ b/lib/rubocop/cop/style/yoda_condition.rb @@ -58,14 +58,11 @@ class YodaCondition < Base extend AutoCorrector MSG = 'Reverse the order of the operands `%s`.' - REVERSE_COMPARISON = { '<' => '>', '<=' => '>=', '>' => '<', '>=' => '<=' }.freeze - EQUALITY_OPERATORS = %i[== !=].freeze - NONCOMMUTATIVE_OPERATORS = %i[===].freeze - PROGRAM_NAMES = %i[$0 $PROGRAM_NAME].freeze + RESTRICT_ON_SEND = RuboCop::AST::Node::COMPARISON_OPERATORS # @!method file_constant_equal_program_name?(node) def_node_matcher :file_constant_equal_program_name?, <<~PATTERN