lib/skunk/cli/commands/status_reporter.rb in skunk-0.1.0 vs lib/skunk/cli/commands/status_reporter.rb in skunk-0.2.0

- old
+ new

@@ -14,11 +14,11 @@ # Returns a status message with a table of all analysed_modules and # a stink score average def update_status_message opts = table_options.merge(headings: HEADINGS, rows: table) - ttable = Terminal::Table.new(opts) + ttable = Terminal::Table.new(opts) @status_message = "#{ttable}\n\n" @status_message += "StinkScore Total: #{total_stink_score}\n" @status_message += "Modules Analysed: #{analysed_modules_count}\n" @@ -27,26 +27,30 @@ end private def analysed_modules_count - @analysed_modules_count ||= analysed_modules.count + @analysed_modules_count ||= non_test_modules.count end + def non_test_modules + @non_test_modules ||= analysed_modules.reject { |x| x.pathname.to_s.start_with?("test", "spec")} + end + def worst @worst ||= sorted_modules.first end def sorted_modules - @sorted_modules ||= analysed_modules.sort_by(&:stink_score).reverse! + @sorted_modules ||= non_test_modules.sort_by(&:stink_score).reverse! end def total_stink_score - @total_stink_score ||= analysed_modules.map(&:stink_score).inject(0.0, :+) + @total_stink_score ||= non_test_modules.map(&:stink_score).inject(0.0, :+) end def total_churn_times_cost - analysed_modules.map(&:churn_times_cost).sum + non_test_modules.map(&:churn_times_cost).sum end def stink_score return 0 if analysed_modules_count == 0