Class: Kaisoku::Evaluator::Report
- Inherits:
-
Object
- Object
- Kaisoku::Evaluator::Report
- Defined in:
- lib/kaisoku/evaluator/report.rb
Instance Method Summary collapse
-
#initialize(results) ⇒ Report
constructor
A new instance of Report.
- #render ⇒ Object
- #safe? ⇒ Boolean
- #to_h ⇒ Object
Constructor Details
#initialize(results) ⇒ Report
Returns a new instance of Report.
6 7 8 |
# File 'lib/kaisoku/evaluator/report.rb', line 6 def initialize(results) @results = results end |
Instance Method Details
#render ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/kaisoku/evaluator/report.rb', line 10 def render [ "=== Kaisoku Evaluation Report (#{@results.length} commits) ===", "Safety violations : #{safety_violations}", "Selection ratio : #{format('%.1f%%', selection_ratio * 100)}", "Reduction ratio : #{format('%.1f%%', reduction_ratio * 100)}", "Precision : #{format('%.1f%%', precision * 100)}", "APFD : #{format('%.2f', apfd)}", "E2E time ratio : #{format('%.1f%%', e2e_time_ratio * 100)}", "Fallback commits : #{fallback_count}/#{@results.length}", diagnostics ].join("\n") end |
#safe? ⇒ Boolean
38 39 40 |
# File 'lib/kaisoku/evaluator/report.rb', line 38 def safe? safety_violations.zero? end |
#to_h ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/kaisoku/evaluator/report.rb', line 24 def to_h { commit_count: @results.length, safety_violations: safety_violations, selection_ratio: selection_ratio, reduction_ratio: reduction_ratio, precision: precision, apfd: apfd, e2e_time_ratio: e2e_time_ratio, fallback_count: fallback_count, commits: @results.map { |result| result_payload(result) } } end |