Class: CodeownersValidator::UncoveredCli

Inherits:
Object
  • Object
show all
Defined in:
lib/codeowners_validator/cli/uncovered_cli.rb

Instance Method Summary collapse

Constructor Details

#initialize(codeowners_path, quiet: false) ⇒ UncoveredCli

Returns a new instance of UncoveredCli.



5
6
7
8
# File 'lib/codeowners_validator/cli/uncovered_cli.rb', line 5

def initialize(codeowners_path, quiet: false)
  @codeowners_path = codeowners_path
  @quiet = quiet
end

Instance Method Details

#runObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/codeowners_validator/cli/uncovered_cli.rb', line 10

def run
  return false unless codeowners_present?

  repo_root = File.dirname(File.expand_path(@codeowners_path))
  lines = File.readlines(@codeowners_path, chomp: true)
  entries = Parser.new(lines).parse
  result = UncoveredFileChecker.new(entries, repo_root).run

  if result.uncovered_files.empty?
    log "No uncovered files found."
    true
  else
    print_uncovered(result.uncovered_files)
    false
  end
end