Skip to content

Commit

Permalink
Use RESTRICT_ON_SEND
Browse files Browse the repository at this point in the history
Follow up to #8365.
  • Loading branch information
koic committed Sep 3, 2021
1 parent 4a67b3f commit 1e1cefe
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
1 change: 1 addition & 0 deletions lib/rubocop/cop/layout/space_after_not.rb
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions lib/rubocop/cop/layout/space_before_brackets.rb
Expand Up @@ -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)
Expand Down
5 changes: 1 addition & 4 deletions lib/rubocop/cop/style/yoda_condition.rb
Expand Up @@ -58,14 +58,11 @@ class YodaCondition < Base
extend AutoCorrector

MSG = 'Reverse the order of the operands `%<source>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
Expand Down

0 comments on commit 1e1cefe

Please sign in to comment.