Class: CodeownersValidator::UncoveredFileChecker

Inherits:
Object
  • Object
show all
Defined in:
lib/codeowners_validator/checkers/uncovered_file_checker.rb

Defined Under Namespace

Classes: Result

Constant Summary collapse

EXCLUDED_DIRS =
%w[.git].freeze
FNMATCH_FLAGS =
File::FNM_PATHNAME | File::FNM_DOTMATCH

Instance Method Summary collapse

Constructor Details

#initialize(entries, repo_root) ⇒ UncoveredFileChecker

Returns a new instance of UncoveredFileChecker.



10
11
12
13
# File 'lib/codeowners_validator/checkers/uncovered_file_checker.rb', line 10

def initialize(entries, repo_root)
  @entries = entries
  @repo_root = repo_root
end

Instance Method Details

#runObject



15
16
17
18
19
20
21
22
# File 'lib/codeowners_validator/checkers/uncovered_file_checker.rb', line 15

def run
  all_files = Dir.glob("**/*", base: @repo_root).select do |path|
    File.file?(File.join(@repo_root, path)) && !excluded?(path)
  end

  uncovered = all_files.reject { |file| covered?(file) }
  Result.new(uncovered_files: uncovered.sort)
end