Class: RuboCop::Cop::Sane::NoMethodCallAfterEnd
- Inherits:
-
Base
- Object
- Base
- RuboCop::Cop::Sane::NoMethodCallAfterEnd
- Defined in:
- lib/rubocop/cop/sane/no_method_call_after_end.rb
Overview
Prohibits calling methods directly after ‘end`.
This cop detects method calls chained directly on blocks, conditionals, and other structures that end with ‘end`. Such code is harder to read and should be refactored to assign the result to a variable first.
Constant Summary collapse
- MSG =
"Do not call methods directly after `end`."- END_KEYWORD_NODES =
[ :if, :case, :case_match, :while, :until, :for, :kwbegin, :block, :numblock, :def, :defs, :class, :module, :sclass, ].freeze
- BLOCK_NODES =
[:block, :numblock].freeze
Instance Method Summary collapse
Instance Method Details
#on_csend(node) ⇒ Object
55 56 57 |
# File 'lib/rubocop/cop/sane/no_method_call_after_end.rb', line 55 def on_csend(node) check_method_call_after_end(node) end |
#on_send(node) ⇒ Object
51 52 53 |
# File 'lib/rubocop/cop/sane/no_method_call_after_end.rb', line 51 def on_send(node) check_method_call_after_end(node) end |