Class: Henitai::Configuration

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

Overview

Loads and validates .henitai.yml configuration.

Configuration is resolved from built-in defaults and the project-root ‘.henitai.yml` file.

Constant Summary collapse

DEFAULT_TIMEOUT =
10.0
DEFAULT_OPERATORS =
:light
DEFAULT_JOBS =
1
DEFAULT_MAX_FLAKY_RETRIES =
3
DEFAULT_REPORTS_DIR =
"reports"
DEFAULT_COVERAGE_CRITERIA =
{
  test_result: true,
  timeout: false,
  process_abort: false
}.freeze
DEFAULT_THRESHOLDS =
{ high: 80, low: 60 }.freeze
CONFIG_FILE =
".henitai.yml"

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path: CONFIG_FILE, overrides: {}) ⇒ Configuration

Returns a new instance of Configuration.



37
38
39
40
41
42
43
44
45
46
# File 'lib/henitai/configuration.rb', line 37

def initialize(path: CONFIG_FILE, overrides: {})
  raw = load_raw_configuration(path)
  unless raw.is_a?(Hash)
    raise Henitai::ConfigurationError,
          "Invalid configuration value for configuration: expected Hash, got #{raw.class}"
  end
  merged = merge_defaults(raw, symbolize_keys(overrides))
  ConfigurationValidator.validate!(merged)
  apply_defaults(merged)
end

Instance Attribute Details

#all_logsObject (readonly)

Returns the value of attribute all_logs.



26
27
28
# File 'lib/henitai/configuration.rb', line 26

def all_logs
  @all_logs
end

#coverage_criteriaObject (readonly)

Returns the value of attribute coverage_criteria.



26
27
28
# File 'lib/henitai/configuration.rb', line 26

def coverage_criteria
  @coverage_criteria
end

#dashboardObject (readonly)

Returns the value of attribute dashboard.



26
27
28
# File 'lib/henitai/configuration.rb', line 26

def dashboard
  @dashboard
end

#ignore_patternsObject (readonly)

Returns the value of attribute ignore_patterns.



26
27
28
# File 'lib/henitai/configuration.rb', line 26

def ignore_patterns
  @ignore_patterns
end

#includesObject (readonly)

Returns the value of attribute includes.



26
27
28
# File 'lib/henitai/configuration.rb', line 26

def includes
  @includes
end

#integrationObject (readonly)

Returns the value of attribute integration.



26
27
28
# File 'lib/henitai/configuration.rb', line 26

def integration
  @integration
end

#jobsObject (readonly)

Returns the value of attribute jobs.



26
27
28
# File 'lib/henitai/configuration.rb', line 26

def jobs
  @jobs
end

#max_flaky_retriesObject (readonly)

Returns the value of attribute max_flaky_retries.



26
27
28
# File 'lib/henitai/configuration.rb', line 26

def max_flaky_retries
  @max_flaky_retries
end

#operatorsObject (readonly)

Returns the value of attribute operators.



26
27
28
# File 'lib/henitai/configuration.rb', line 26

def operators
  @operators
end

#reportersObject (readonly)

Returns the value of attribute reporters.



26
27
28
# File 'lib/henitai/configuration.rb', line 26

def reporters
  @reporters
end

#reports_dirObject (readonly)

Returns the value of attribute reports_dir.



26
27
28
# File 'lib/henitai/configuration.rb', line 26

def reports_dir
  @reports_dir
end

#samplingObject (readonly)

Returns the value of attribute sampling.



26
27
28
# File 'lib/henitai/configuration.rb', line 26

def sampling
  @sampling
end

#thresholdsObject (readonly)

Returns the value of attribute thresholds.



26
27
28
# File 'lib/henitai/configuration.rb', line 26

def thresholds
  @thresholds
end

#timeoutObject (readonly)

Returns the value of attribute timeout.



26
27
28
# File 'lib/henitai/configuration.rb', line 26

def timeout
  @timeout
end

Class Method Details

.load(path: CONFIG_FILE, overrides: {}) ⇒ Object

Parameters:

  • path (String) (defaults to: CONFIG_FILE)

    path to .henitai.yml (default: project root)



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

def self.load(path: CONFIG_FILE, overrides: {})
  new(path:, overrides:)
end