Class: RSpec::Hermetic::CorpusEvaluation
- Inherits:
-
Object
- Object
- RSpec::Hermetic::CorpusEvaluation
- Defined in:
- lib/rspec/hermetic/corpus_evaluation.rb,
sig/rspec/hermetic.rbs
Instance Method Summary collapse
-
#initialize(output_path:, project_path: Dir.pwd, baseline_command: nil, hermetic_command:, candidate_report_path: "tmp/rspec_hermetic_candidates.json", judgments_path: nil) ⇒ CorpusEvaluation
constructor
A new instance of CorpusEvaluation.
- #run ⇒ Hash[String, untyped]
Constructor Details
#initialize(output_path:, project_path: Dir.pwd, baseline_command: nil, hermetic_command:, candidate_report_path: "tmp/rspec_hermetic_candidates.json", judgments_path: nil) ⇒ CorpusEvaluation
Returns a new instance of CorpusEvaluation.
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/rspec/hermetic/corpus_evaluation.rb', line 13 def initialize( output_path:, project_path: Dir.pwd, baseline_command: nil, hermetic_command:, candidate_report_path: "tmp/rspec_hermetic_candidates.json", judgments_path: nil ) @output_path = output_path @project_path = project_path @baseline_command = baseline_command @hermetic_command = hermetic_command @candidate_report_path = candidate_report_path @judgments_path = judgments_path end |
Instance Method Details
#run ⇒ Hash[String, untyped]
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/rspec/hermetic/corpus_evaluation.rb', line 29 def run baseline = run_command(@baseline_command) if @baseline_command hermetic = run_command(@hermetic_command) candidates = read_candidates report = { "project_path" => @project_path, "generated_at" => Time.now.utc.iso8601, "baseline" => baseline, "hermetic" => hermetic, "overhead" => overhead(baseline, hermetic), "candidates" => candidates, "candidate_count" => candidates.length, "false_alarm" => false_alarm_summary(candidates) }.compact write(report) report end |