Class: RuboCop::Cop::Airbnb::ContinuationSlash

Inherits:
Base
  • Object
show all
Defined in:
lib/rubocop/cop/airbnb/continuation_slash.rb

Constant Summary collapse

MSG =
'Slash continuation should be reserved for closed string continuation. ' \
'Many times it is used to get around other existing rules.'.freeze

Instance Method Summary collapse

Instance Method Details

#enforce_violation(node) ⇒ Object Also known as: on_send, on_if



8
9
10
11
12
# File 'lib/rubocop/cop/airbnb/continuation_slash.rb', line 8

def enforce_violation(node)
  return if node.source.match(/["']\s*\\\n/)
  return unless node.source.match(/\\\n/)
  add_offense(node, message: message)
end