Class: RakeCheck::Checker::Cane

Inherits:
Base
  • Object
show all
Defined in:
lib/rake_check/checker/cane.rb

Overview

Checks cane output

Instance Attribute Summary

Attributes inherited from Base

#check_output, #options, #time

Instance Method Summary collapse

Methods inherited from Base

#initialize, #status, #type

Constructor Details

This class inherits a constructor from RakeCheck::Checker::Base

Instance Method Details

#runObject



10
11
12
# File 'lib/rake_check/checker/cane.rb', line 10

def run
  run_command 'cane'
end

#short_messageObject



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/rake_check/checker/cane.rb', line 14

def short_message
  @short_message ||= begin
    if violations_count > 0
      violations = case violations_count
      when 0
        violations_count.to_s.green
      when 1..9
        violations_count.to_s.yellow
      else
        violations_count.to_s.yellow
      end
      "with #{violations} Violations"
    end
  end
end

#success?Boolean

Returns:

  • (Boolean)


30
31
32
# File 'lib/rake_check/checker/cane.rb', line 30

def success?
  super && violations_count < 10
end

#violations_countObject



34
35
36
# File 'lib/rake_check/checker/cane.rb', line 34

def violations_count
  (check_output[/Total Violations: (\d+)/, 1] || 0).to_i
end