Class: Skunk::Command::StatusReporter

Inherits:
RubyCritic::Command::StatusReporter
  • Object
show all
Defined in:
lib/skunk/commands/status_reporter.rb

Overview

Knows how to report status for stinky files

Direct Known Subclasses

StatusSharer

Constant Summary collapse

HEADINGS =
%w[file skunk_score churn_times_cost churn cost coverage].freeze
HEADINGS_WITHOUT_FILE =
HEADINGS - %w[file]
HEADINGS_WITHOUT_FILE_WIDTH =

padding

HEADINGS_WITHOUT_FILE.size * 17
TEMPLATE =
ERB.new(<<-TEMPL
<%= _ttable %>\n
SkunkScore Total: <%= total_skunk_score %>
Modules Analysed: <%= analysed_modules_count %>
SkunkScore Average: <%= skunk_score_average %>
<% if worst %>Worst SkunkScore: <%= worst.skunk_score %> (<%= worst.pathname %>)<% end %>

Generated with Skunk v<%= Skunk::VERSION %>
TEMPL
)

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#analysed_modulesObject

Returns the value of attribute analysed_modules.



11
12
13
# File 'lib/skunk/commands/status_reporter.rb', line 11

def analysed_modules
  @analysed_modules
end

Instance Method Details

#update_status_messageObject

Returns a status message with a table of all analysed_modules and a skunk score average



30
31
32
33
34
35
36
# File 'lib/skunk/commands/status_reporter.rb', line 30

def update_status_message
  opts = table_options.merge(headings: HEADINGS, rows: table)

  _ttable = Terminal::Table.new(opts)

  @status_message = TEMPLATE.result(binding)
end