Class: Keela::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/keela/configuration.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/keela/configuration.rb', line 41

def initialize
  @extensions = %w[rb haml erb].freeze
  @directory_patterns = %w[
    app/**/*.%<ext>s
    lib/**/*.%<ext>s
    config/**/*.%<ext>s
  ].freeze
  @excluded_path = nil
  @baseline_path = nil
  @required_directory = nil
  @show_progress = true
  @exclude_patterns = []
  @include_patterns = []
  @verbose = false
  @source_location = false
  @strategy_options = {}
end

Instance Attribute Details

#baseline_pathObject

Path to YAML file tracking known unused items (baseline)



15
16
17
# File 'lib/keela/configuration.rb', line 15

def baseline_path
  @baseline_path
end

#directory_patternsObject

Directory patterns to scan (use %s as placeholder for extension)



9
10
11
# File 'lib/keela/configuration.rb', line 9

def directory_patterns
  @directory_patterns
end

#exclude_patternsObject

Glob patterns for files to exclude from scanning



24
25
26
# File 'lib/keela/configuration.rb', line 24

def exclude_patterns
  @exclude_patterns
end

#excluded_pathObject

Path to YAML file listing excluded items (won't be flagged as unused)



12
13
14
# File 'lib/keela/configuration.rb', line 12

def excluded_path
  @excluded_path
end

#extensionsObject

File extensions to scan for code usage



6
7
8
# File 'lib/keela/configuration.rb', line 6

def extensions
  @extensions
end

#include_patternsObject

Additional directory patterns to include (added to directory_patterns)



27
28
29
# File 'lib/keela/configuration.rb', line 27

def include_patterns
  @include_patterns
end

#required_directoryObject

Optional directory that must exist for scanning to proceed (e.g., "ee" for GitLab)



18
19
20
# File 'lib/keela/configuration.rb', line 18

def required_directory
  @required_directory
end

#show_progressObject

Whether to show progress during scanning



21
22
23
# File 'lib/keela/configuration.rb', line 21

def show_progress
  @show_progress
end

#source_locationObject

Whether to show source location (file:line) in reports



33
34
35
# File 'lib/keela/configuration.rb', line 33

def source_location
  @source_location
end

#strategy_optionsObject

Per-strategy configuration options Hash of strategy_name => { option => value } Supported options:

- definition_file_pattern: Regex pattern string for files containing definitions


39
40
41
# File 'lib/keela/configuration.rb', line 39

def strategy_options
  @strategy_options
end

#verboseObject

Whether to show verbose debugging output



30
31
32
# File 'lib/keela/configuration.rb', line 30

def verbose
  @verbose
end

Instance Method Details

#options_for(strategy_name) ⇒ Object

Get options for a specific strategy



60
61
62
# File 'lib/keela/configuration.rb', line 60

def options_for(strategy_name)
  strategy_options[strategy_name.to_s] || {}
end