Module: LintTrappings::FileFinder
- Defined in:
- lib/lint_trappings/file_finder.rb
Overview
Finds files that should be linted.
Class Method Summary collapse
-
.find(options) ⇒ Array<String>
Return list of lintable files given the specified set of paths and glob pattern search criteria.
Class Method Details
.find(options) ⇒ Array<String>
Return list of lintable files given the specified set of paths and glob pattern search criteria.
The distinction between paths and globs is so files with a ‘*` in their name can still be matched if necessary without treating them as a glob pattern.
26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/lint_trappings/file_finder.rb', line 26 def find() included_paths = .fetch(:included_paths, []).map { |p| normalize_path(p) } excluded_paths = .fetch(:excluded_paths, []).map { |p| normalize_path(p) } included_patterns = .fetch(:included_patterns, []).map { |p| normalize_path(p) } excluded_patterns = .fetch(:excluded_patterns, []).map { |p| normalize_path(p) } allowed_extensions = .fetch(:allowed_extensions) included_files = (included_paths, included_patterns, allowed_extensions) matching_files = filter_files(included_files, excluded_paths, excluded_patterns) matching_files.uniq.sort end |