Class: CustomCops::TimecopWithoutBlock
- Inherits:
-
RuboCop::Cop::Base
- Object
- RuboCop::Cop::Base
- CustomCops::TimecopWithoutBlock
- Defined in:
- lib/simplycop/custom_cops/timecop_without_block.rb
Constant Summary collapse
- MSG =
'Avoid using `Timecop.%<method>s` without providing a block.'
Instance Method Summary collapse
Instance Method Details
#on_send(node) ⇒ Object
9 10 11 12 13 14 15 |
# File 'lib/simplycop/custom_cops/timecop_without_block.rb', line 9 def on_send(node) timecop_method(node) do |method_name| return if !method_name || first_child_of_block?(node) || last_child_is_a_block(node) add_offense(node.loc.selector, message: format(MSG, method: method_name)) end end |