lib/rubocop/cop/line_continuation.rb in rubocop-0.7.2 vs lib/rubocop/cop/line_continuation.rb in rubocop-0.8.0
- old
+ new
@@ -1,17 +1,14 @@
# encoding: utf-8
module Rubocop
module Cop
class LineContinuation < Cop
- ERROR_MESSAGE = 'Avoid the use of the line continuation character(/).'
+ MSG = 'Avoid the use of the line continuation character(\).'
- def inspect(file, source, tokens, sexp)
- tokens.each_index do |ix|
- t = tokens[ix]
- if t.type == :on_sp && t.text == "\\\n"
- add_offence(:convention, t.pos.lineno, ERROR_MESSAGE)
- end
+ def inspect(source, tokens, ast, comments)
+ source.each_with_index do |line, index|
+ add_offence(:convention, index, MSG) if line =~ /.*\\\z/
end
end
end
end
end