Sha256: e7b40c331470981855166369b714bdfe540b91cda1db20177b2d3c4f60333f21

Contents?: true

Size: 1.51 KB

Versions: 20

Compression:

Stored size: 1.51 KB

Contents

module CC
  module Formatters
    class LinkedFormatter < CC::Service::Formatter
      def format_test
        message = message_prefix
        message << "This is a test of the #{service_title} service hook"
      end

      def format_coverage
        message = message_prefix
        message << "#{format_link(details_url, "Test coverage")}"
        message << " has #{changed} to #{covered_percent}% (#{delta})"

        if compare_url
          message << " (#{format_link(compare_url, "Compare")})"
        end

        message
      end

      def format_quality
        message = message_prefix
        message << "#{format_link(details_url, constant_name)}"
        message << " has #{changed} from #{previous_rating} to #{rating}"

        if compare_url
          message << " (#{format_link(compare_url, "Compare")})"
        end

        message
      end

      def format_vulnerability
        message = message_prefix

        if multiple?
          message << "#{vulnerabilities.size} new"
          message << " #{format_link(details_url, warning_type)}"
          message << " issues found"
        else
          message << "New #{format_link(details_url, warning_type)}"
          message << " issue found"
          message << location_info
        end

        message
      end

      private

      def format_link(url, text)
        case options[:link_style]
        when :html then "<a href=\"#{url}\">#{text}</a>"
        when :wiki then "<#{url}|#{text}>"
        else text
        end
      end
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
codeclimate-services-1.6.1 lib/cc/formatters/linked_formatter.rb
codeclimate-services-1.6.0 lib/cc/formatters/linked_formatter.rb
codeclimate-services-1.5.1 lib/cc/formatters/linked_formatter.rb
codeclimate-services-1.5.0 lib/cc/formatters/linked_formatter.rb
codeclimate-services-1.4.0 lib/cc/formatters/linked_formatter.rb
codeclimate-services-1.3.0 lib/cc/formatters/linked_formatter.rb
codeclimate-services-1.2.0 lib/cc/formatters/linked_formatter.rb
codeclimate-services-1.1.0 lib/cc/formatters/linked_formatter.rb
codeclimate-services-1.0.1 lib/cc/formatters/linked_formatter.rb
codeclimate-services-1.0.0 lib/cc/formatters/linked_formatter.rb
codeclimate-services-0.6.2 lib/cc/formatters/linked_formatter.rb
codeclimate-services-0.6.1 lib/cc/formatters/linked_formatter.rb
codeclimate-services-0.6.0 lib/cc/formatters/linked_formatter.rb
codeclimate-services-0.5.3 lib/cc/formatters/linked_formatter.rb
codeclimate-services-0.5.2 lib/cc/formatters/linked_formatter.rb
codeclimate-services-0.5.1 lib/cc/formatters/linked_formatter.rb
codeclimate-services-0.5.0 lib/cc/formatters/linked_formatter.rb
codeclimate-services-0.4.1 lib/cc/formatters/linked_formatter.rb
codeclimate-services-0.4.0 lib/cc/formatters/linked_formatter.rb
codeclimate-services-0.3.0 lib/cc/formatters/linked_formatter.rb