Class: RuboCop::Cop::Sevencop::RSpecMatcherConsistentParentheses
- Inherits:
-
Base
- Object
- Base
- RuboCop::Cop::Sevencop::RSpecMatcherConsistentParentheses
- Extended by:
- AutoCorrector
- Defined in:
- lib/rubocop/cop/sevencop/rspec_matcher_consistent_parentheses.rb
Overview
Keep consistent parentheses style in RSpec matchers.
Constant Summary collapse
- MSG =
'Keep consistent parentheses style in RSpec matchers.'
- RESTRICT_ON_SEND =
%i[to].freeze
Instance Method Summary collapse
Instance Method Details
#on_send(node) ⇒ void
This method returns an undefined value.
23 24 25 26 27 28 29 30 31 32 |
# File 'lib/rubocop/cop/sevencop/rspec_matcher_consistent_parentheses.rb', line 23 def on_send(node) return unless to?(node) first_argument = node.first_argument return unless inconsistent?(first_argument) add_offense(first_argument) do |corrector| add_parentheses(first_argument, corrector) end end |