Skip to content

Commit bb22e76

Browse files
committed
Don't print newline if there are no redundancies
1 parent cfabfc9 commit bb22e76

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
* Colorizes text output.
44
* Supports scss/sass files.
5+
* Fixes newline output bug when there are no redundancies
56

67
## 0.1.0 ##
78

lib/csscss/cli.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ def execute
4545
if @json
4646
puts JSONReporter.new(combined_redundancies).report
4747
else
48-
puts Reporter.new(combined_redundancies).report(verbose:@verbose, color:true)
48+
report = Reporter.new(combined_redundancies).report(verbose:@verbose, color:true)
49+
puts report unless report.empty?
4950
end
5051

5152
rescue Parslet::ParseFailed => e

test/csscss/reporter_test.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,10 @@ module Csscss
2929
EXPECTED
3030
reporter.report(verbose:true, color:false).must_equal expected
3131
end
32+
33+
it "prints a new line if there is nothing" do
34+
reporter = Reporter.new({})
35+
reporter.report().must_equal ""
36+
end
3237
end
3338
end

0 commit comments

Comments
 (0)