Class: CodeownerValidator::Tasks::DuplicateChecker

Inherits:
Base
  • Object
show all
Includes:
Group
Defined in:
lib/codeowner_validator/tasks/duplicate_checker.rb

Overview

Public: The duplicate checker executes an evaluation on the code owners file looking for duplicate pattern references

Instance Method Summary collapse

Methods inherited from Base

#codeowners, #execute, #initialize

Methods included from UtilityHelper

#in_folder, #with_clean_env

Methods included from Command

#run

Methods included from Logging

#log_command, #log_error, #log_info, #log_stderr, #log_verbose, #log_warn, #logger, #program_name

Constructor Details

This class inherits a constructor from CodeownerValidator::Tasks::Base

Instance Method Details

#commentsObject

See Also:



19
20
21
22
23
24
25
26
27
28
29
# File 'lib/codeowner_validator/tasks/duplicate_checker.rb', line 19

def comments
  comments = []

  codeowners.duplicated_patterns.each do |key, value|
    msg = "Pattern '#{key}' is defined #{value.size} times on lines " \
          "#{value.map(&:line_number).join(', ')}"
    comments << Comment.build(comment: msg, type: Comment::TYPE_ERROR)
  end

  comments
end

#summaryObject

See Also:



14
15
16
# File 'lib/codeowner_validator/tasks/duplicate_checker.rb', line 14

def summary
  'Executing Duplicated Pattern Checker'
end