Module: RspecSprint::Formatter
- Defined in:
- lib/rspec_sprint/formatter.rb
Overview
Renders ranked findings as a terminal report. Asserts the top few; when no rule fired it says so explicitly rather than padding with generic advice (design D8).
Class Method Summary collapse
Class Method Details
.format(findings) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/rspec_sprint/formatter.rb', line 10 def format(findings) return no_bottleneck if findings.empty? lines = ["rspec-sprint doctor — 上位#{findings.size}件 (信号があった項目のみ):", ""] findings.each_with_index do |f, i| lines << "#{i + 1}. #{f.headline}" f.prescriptions.each { |p| lines << " → #{p}" } lines << " 想定削減: #{f.expected_saving}" if f.expected_saving lines << " 参考: #{f.doc_url}" if f.doc_url lines << "" end lines.join("\n") end |
.no_bottleneck ⇒ Object
24 25 26 27 |
# File 'lib/rspec_sprint/formatter.rb', line 24 def no_bottleneck "支配的なボトルネックは検出されませんでした(各指標は閾値以下=該当なし)。" \ "生の数値は --verbose で出せますが、いま無理に直すべき箇所はありません。" end |