Class: Codeowners::Reporter

Inherits:
Object
  • Object
show all
Defined in:
lib/codeowners/reporter.rb

Overview

This class is responsible for print the reports

Constant Summary collapse

LABELS =
{
  missing_ref: 'No owner defined',
  useless_pattern: 'Useless patterns',
  invalid_owner: 'Invalid owner',
  unrecognized_line: 'Unrecognized line'
}.freeze

Class Method Summary collapse

Class Method Details



27
28
29
# File 'lib/codeowners/reporter.rb', line 27

def print(*args)
  puts(*args)
end

Raises:

  • (ArgumentError)


14
15
16
17
18
# File 'lib/codeowners/reporter.rb', line 14

def print_delimiter_line(error_type)
  raise ArgumentError, "unknown error type '#{error_type}'" unless LABELS.key?(error_type)

  print('-' * 30, LABELS[error_type], '-' * 30)
end


20
21
22
23
24
25
# File 'lib/codeowners/reporter.rb', line 20

def print_error(error_type, inconsistencies, meta)
  case error_type
  when :invalid_owner then print("#{inconsistencies} MISSING: #{meta.join(', ')}")
  else print(inconsistencies.to_s)
  end
end