Class: SixthSense::Guardrail::Evaluator
- Inherits:
-
Object
- Object
- SixthSense::Guardrail::Evaluator
- Defined in:
- lib/sixth_sense/guardrail/evaluator.rb
Instance Method Summary collapse
- #evaluate(reports, level:) ⇒ Object
-
#initialize(config:, baseline: Baseline.load) ⇒ Evaluator
constructor
A new instance of Evaluator.
Constructor Details
Instance Method Details
#evaluate(reports, level:) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/sixth_sense/guardrail/evaluator.rb', line 19 def evaluate(reports, level:) threshold_violations = threshold_violations(reports, level: level) tolerance = @config.fetch(:guardrail, :tolerance, default: 1.0).to_f baseline_violations = ratchet? ? @baseline.violations(reports, current_level: level, tolerance: tolerance) : [] warnings = ratchet? ? @baseline.warnings(reports, current_level: level, tolerance: tolerance) : [] Evaluation.new( passed: threshold_violations.empty? && baseline_violations.empty?, violations: threshold_violations, baseline_violations: baseline_violations, warnings: warnings ) end |