Sha256: 8ed80578a36ced63eba66a4cf1e29d57ff324ca232d4e10142cf0f30e2be36c3

Contents?: true

Size: 823 Bytes

Versions: 4

Compression:

Stored size: 823 Bytes

Contents

##
# CaneChecker checks the output code smells with cane
#
# @author dmasur
module RakeCheck
  module Checker
    ##
    # Checks cane output
    class Cane < Base
      def run
        run_command 'cane'
      end

      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

      def success?
        super && violations_count < 10
      end

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

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rake_check-0.4.2 lib/rake_check/checker/cane.rb
rake_check-0.4.1 lib/rake_check/checker/cane.rb
rake_check-0.4.0 lib/rake_check/checker/cane.rb
rake_check-0.3.6 lib/rake_check/checker/cane.rb