Module: RuboCop::Cop::Style::MethodCallWithArgsParentheses::OmitParentheses

Includes:
RangeHelp, ReparsedEquivalence
Included in:
RuboCop::Cop::Style::MethodCallWithArgsParentheses
Defined in:
lib/rubocop/cop/style/method_call_with_args_parentheses/omit_parentheses.rb

Overview

Style omit_parentheses rubocop:disable Metrics/ModuleLength, Metrics/CyclomaticComplexity

Constant Summary collapse

TRAILING_WHITESPACE_REGEX =
/\s+\Z/.freeze

Constants included from ReparsedEquivalence

ReparsedEquivalence::MAX_VERIFICATION_FRAGMENT_SIZE

Constants included from RangeHelp

RangeHelp::BYTE_ORDER_MARK, RangeHelp::NOT_GIVEN

Instance Method Summary collapse

Instance Method Details

#on_investigation_endObject



17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/rubocop/cop/style/method_call_with_args_parentheses/omit_parentheses.rb', line 17

def on_investigation_end
  # Each candidate's exact correction is verified by reparsing before
  # the offense is registered, so an omission that would change how
  # the code parses is never reported or offered.
  verified_by_reparse(@pending_omit_offenses || []).each do |node|
    add_offense(offense_range(node), message: OMIT_MSG) do |corrector|
      autocorrect(corrector, node)
    end
  end
  @pending_omit_offenses = []

  super
end