lib/rubocop/comment_config.rb in rubocop-0.32.0 vs lib/rubocop/comment_config.rb in rubocop-0.32.1

- old
+ new

@@ -2,10 +2,11 @@ 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 + UNNEEDED_DISABLE = 'Lint/UnneededDisable' COMMENT_DIRECTIVE_REGEXP = Regexp.new( '\A# rubocop : ((?:dis|en)able)\b ((?:[\w/]+,? )+)'.gsub(' ', '\s*') ) attr_reader :processed_source @@ -71,10 +72,12 @@ end end end def all_cop_names - @all_cop_names ||= Cop::Cop.all.map(&:cop_name) + @all_cop_names ||= Cop::Cop.all.map(&:cop_name).reject do |cop_name| + cop_name == UNNEEDED_DISABLE + end end def comment_only_line?(line_number) non_comment_token_line_numbers.none? do |non_comment_line_number| non_comment_line_number == line_number