Class: HamlLint::FileFinder
- Inherits:
-
Object
- Object
- HamlLint::FileFinder
- Defined in:
- lib/haml_lint/file_finder.rb
Overview
Finds Haml files that should be linted given a specified list of paths, glob patterns, and configuration.
Constant Summary collapse
- VALID_EXTENSIONS =
List of extensions of files to include under a directory when a directory is specified instead of a file.
%w[.haml].freeze
Instance Method Summary collapse
-
#find(patterns, excluded_patterns) ⇒ Array<String>
Return list of files to lint given the specified set of paths and glob patterns.
-
#initialize(config) ⇒ FileFinder
constructor
Create a file finder using the specified configuration.
Constructor Details
#initialize(config) ⇒ FileFinder
Create a file finder using the specified configuration.
16 17 18 |
# File 'lib/haml_lint/file_finder.rb', line 16 def initialize(config) @config = config end |
Instance Method Details
#find(patterns, excluded_patterns) ⇒ Array<String>
Return list of files to lint given the specified set of paths and glob patterns.
26 27 28 29 30 31 32 33 34 |
# File 'lib/haml_lint/file_finder.rb', line 26 def find(patterns, excluded_patterns) excluded_patterns = excluded_patterns.map { |pattern| normalize_path(pattern) } extract_files_from(patterns).reject do |file| excluded_patterns.any? do |exclusion_glob| HamlLint::Utils.any_glob_matches?(exclusion_glob, file) end end end |