lib/rubocop/comment_config.rb in rubocop-0.22.0 vs lib/rubocop/comment_config.rb in rubocop-0.23.0
- old
+ new
@@ -1,13 +1,13 @@
# encoding: utf-8
-module Rubocop
+module RuboCop
# This class parses the special `rubocop:disable` comments in a source
# and provides a way to check if each cop is enabled at arbitrary line.
class CommentConfig
COMMENT_DIRECTIVE_REGEXP = Regexp.new(
- '\A# rubocop : ((?:dis|en)able)\b ((?:\w+,? )+)'.gsub(' ', '\s*')
+ '\A# rubocop : ((?:dis|en)able)\b ((?:[\w/]+,? )+)'.gsub(' ', '\s*')
)
attr_reader :processed_source
def initialize(processed_source)
@@ -73,9 +73,11 @@
disabled = (switch == 'disable')
comment_line_number = comment.loc.expression.line
single_line = !comment_only_line?(comment_line_number)
cop_names.each do |cop_name|
+ cop_name = Cop::Cop.qualified_cop_name(cop_name,
+ processed_source.buffer.name)
yield cop_name, disabled, comment_line_number, single_line
end
end
end