Module: RspecSprint::Diagnosis
- Defined in:
- lib/rspec_sprint/diagnosis.rb
Overview
Pure pipeline: profiler JSON files -> normalized snapshot -> ranked findings -> rendered report. Decoupled from how the JSON was produced (a live run, a fixture, or a CI artifact), per design D3.
Class Method Summary collapse
- .baseline_saved_msg ⇒ Object
- .from_files(rspec_json:, factory_prof_json: nil, save_snapshot: false, compare_last: false, save_baseline: false) ⇒ Object
Class Method Details
.baseline_saved_msg ⇒ Object
30 31 32 33 |
# File 'lib/rspec_sprint/diagnosis.rb', line 30 def baseline_saved_msg "ベースライン保存済み: #{SnapshotStore::BASELINE_PATH}\n" \ "(Baseline saved — run `rspec-sprint compare` to compare future runs)" end |
.from_files(rspec_json:, factory_prof_json: nil, save_snapshot: false, compare_last: false, save_baseline: false) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/rspec_sprint/diagnosis.rb', line 16 def from_files(rspec_json:, factory_prof_json: nil, save_snapshot: false, compare_last: false, save_baseline: false) # Load previous BEFORE saving so "last" refers to the prior run, not this one. previous = compare_last ? SnapshotStore.load_last : nil snapshot = Normalizer.new(rspec_json: rspec_json, factory_prof_json: factory_prof_json).call SnapshotStore.save(snapshot) if save_snapshot SnapshotStore.save_baseline(snapshot) if save_baseline sections = [Formatter.format(Ranker.call(snapshot))] sections << Comparator.format_delta(previous, snapshot) if compare_last sections << baseline_saved_msg if save_baseline sections.join("\n\n") end |