From 1c6dc05ddf4b666d2dddc187489c2c5302fb92dc Mon Sep 17 00:00:00 2001 From: Vsevolod Voloshyn Date: Sat, 14 Mar 2020 19:15:15 +0200 Subject: [PATCH] Make output fully green if there are no offenses --- lib/fasterer/file_traverser.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/fasterer/file_traverser.rb b/lib/fasterer/file_traverser.rb index ac83f3c..a84ed09 100644 --- a/lib/fasterer/file_traverser.rb +++ b/lib/fasterer/file_traverser.rb @@ -155,12 +155,14 @@ def inspected_files_output end def offenses_found_output + color = @offenses_found_count.zero? :green : :red "#{@offenses_found_count} #{pluralize(@offenses_found_count, 'offense')} detected" - .colorize(:red) + .colorize(color) end def unparsable_files_output return if @unparsable_files_count.zero? + "#{@unparsable_files_count} unparsable #{pluralize(@unparsable_files_count, 'file')} found" .colorize(:red) end