class BoxtRubyStyleGuide::FilepathMatcher

Sanitizes a list of filepaths based on Rubocops exclusions

Constants

EXCLUDE_PATTERNS

Array of the excluded files from Rubocop default.yml config

FILEPATH_PATTERN_MATCH

Compare a given filepath with a grep-style filename pattern

INCLUDE_PATTERNS

Array of file patterns to make sure we only check files that are Ruby files

Attributes

filepaths[R]

Public Class Methods

new(*filepaths) click to toggle source
# File lib/boxt_ruby_style_guide/filepath_matcher.rb, line 33
def initialize(*filepaths)
  @filepaths = filepaths
end

Public Instance Methods

all_matches() click to toggle source
# File lib/boxt_ruby_style_guide/filepath_matcher.rb, line 37
def all_matches
  filepaths.select do |filepath|
    filepath_proc = FILEPATH_PATTERN_MATCH.curry.call(filepath)
    INCLUDE_PATTERNS.any?(filepath_proc) && EXCLUDE_PATTERNS.none?(filepath_proc)
  end
end