From 9917db867e2a64344cd8342067a40281adadf094 Mon Sep 17 00:00:00 2001 From: Kevin Rutherford Date: Wed, 1 Jul 2009 21:37:26 +0100 Subject: [PATCH] Fixed formatting for smell-free reports --- features/reports.feature | 14 +++++++++++++- lib/reek/report.rb | 3 ++- spec/samples/three_clean_files/clean_one.rb | 6 ++++++ spec/samples/three_clean_files/clean_three.rb | 6 ++++++ spec/samples/three_clean_files/clean_two.rb | 6 ++++++ 5 files changed, 33 insertions(+), 2 deletions(-) create mode 100644 spec/samples/three_clean_files/clean_one.rb create mode 100644 spec/samples/three_clean_files/clean_three.rb create mode 100644 spec/samples/three_clean_files/clean_two.rb diff --git a/features/reports.feature b/features/reports.feature index 4d2c170c3..ac5eb2800 100644 --- a/features/reports.feature +++ b/features/reports.feature @@ -1,5 +1,5 @@ @reports -Feature: Correclty formatted reports +Feature: Correctly formatted reports In order to get the most out of reek As a developer I want to be able to parse reek's output simply and consistently @@ -26,3 +26,15 @@ Feature: Correclty formatted reports """ + Scenario: good files show headers consecutively + When I run reek spec/samples/three_clean_files/*.rb + Then it succeeds + And it reports: + """ + spec/samples/three_clean_files/clean_one.rb -- 0 warnings + spec/samples/three_clean_files/clean_three.rb -- 0 warnings + spec/samples/three_clean_files/clean_two.rb -- 0 warnings + + """ + + diff --git a/lib/reek/report.rb b/lib/reek/report.rb index 40c24a5c7..30f56e79f 100644 --- a/lib/reek/report.rb +++ b/lib/reek/report.rb @@ -58,7 +58,8 @@ def [](index) # :nodoc: # this report, with a heading. def full_report(desc) result = header(desc, @report.length) - result += ":\n#{to_s}\n" if length > 0 + result += ":\n#{to_s}" if length > 0 + result += "\n" result end diff --git a/spec/samples/three_clean_files/clean_one.rb b/spec/samples/three_clean_files/clean_one.rb new file mode 100644 index 000000000..56885375f --- /dev/null +++ b/spec/samples/three_clean_files/clean_one.rb @@ -0,0 +1,6 @@ +class Clean + def assign + puts @sub.title + @sub.map {|para| para.name } + end +end diff --git a/spec/samples/three_clean_files/clean_three.rb b/spec/samples/three_clean_files/clean_three.rb new file mode 100644 index 000000000..56885375f --- /dev/null +++ b/spec/samples/three_clean_files/clean_three.rb @@ -0,0 +1,6 @@ +class Clean + def assign + puts @sub.title + @sub.map {|para| para.name } + end +end diff --git a/spec/samples/three_clean_files/clean_two.rb b/spec/samples/three_clean_files/clean_two.rb new file mode 100644 index 000000000..56885375f --- /dev/null +++ b/spec/samples/three_clean_files/clean_two.rb @@ -0,0 +1,6 @@ +class Clean + def assign + puts @sub.title + @sub.map {|para| para.name } + end +end