Class: CC::Engine::FileList

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Includes:
Enumerable
Defined in:
lib/cc/engine/file_list.rb

Overview

Gathers a list of files to analyze with the engine

Constant Summary collapse

HAML_EXTENSION =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

The extension to filter Haml files by.

Returns:

  • (String)
'.haml'

Instance Method Summary collapse

Constructor Details

#initialize(root:, engine_config:, linter_config:) ⇒ FileList

Instantiates a new FileList

configuration per the CodeClimate specification

Examples:

CC::Engine::FileList.new(
  root: "/tmp",
  engine_config: CC::Engine::Configuration.new,
  linter_config: {}
)

Parameters:

  • root (String)

    the root directory to pull files from

  • engine_config (CC::Engine::Configuration)

    the engine

  • linter_config (HamlLint::Configuration)

    the +haml_lint+ configuration loaded from +.haml-lint.yml+


35
36
37
38
39
40
# File 'lib/cc/engine/file_list.rb', line 35

def initialize(root:, engine_config:, linter_config:)
  @root = root
  @exclude_paths = paths_from_root(engine_config.exclude_paths)
  @include_paths = engine_config.include_paths
  @linter_config = linter_config
end

Instance Method Details

#eachEnumerator

Enumerates through the file list

Examples:

CC::Engine::FileList.new(
  root: "/tmp",
  engine_config: CC::Engine::Configuration.new,
  linter_config: {}
).each  #=> Enumerator

Returns:

  • (Enumerator)

    an enumerator of the files in the list

See Also:

  • Array#each

55
# File 'lib/cc/engine/file_list.rb', line 55

def_delegator :filtered_files, :each