Class: RuboCop::Cop::Lint::BlockSleep

Inherits:
Base
  • Object
show all
Defined in:
lib/rubocop/cop/lint/block_sleep.rb

Overview

TODO: Write cop description and example of bad / good code. For every ‘SupportedStyle` and unique configuration, there needs to be examples. Examples must have valid Ruby syntax. Do not use upticks.

Examples:

EnforcedStyle: bar (default)

# Description of the `bar` style.

# bad
bad_bar_method

# bad
bad_bar_method(args)

# good
good_bar_method

# good
good_bar_method(args)

EnforcedStyle: foo

# Description of the `foo` style.

# bad
bad_foo_method

# bad
bad_foo_method(args)

# good
good_foo_method

# good
good_foo_method(args)

Constant Summary collapse

MSG =

TODO: Implement the cop in here.

In many cases, you can use a node matcher for matching node pattern. See github.com/rubocop-hq/rubocop-ast/blob/master/lib/rubocop/ast/node_pattern.rb

For example

'Use of sleep detected.'

Instance Method Summary collapse

Instance Method Details

#on_send(node) ⇒ Object



54
55
56
57
58
# File 'lib/rubocop/cop/lint/block_sleep.rb', line 54

def on_send(node)
  return unless use_sleep?(node)

  add_offense(node, severity: :refactor)
end