Sha256: ddc0bd1c97cbfea18cfdf0587ef506862f329cb4da5cbcc3df970854fa7bb066

Contents?: true

Size: 787 Bytes

Versions: 75

Compression:

Stored size: 787 Bytes

Contents

module CC
  module Analyzer
    class EngineOutput
      delegate :blank?, to: :raw_output
      delegate :to_json, to: :as_issue

      def initialize(raw_output)
        @raw_output = raw_output
      end

      def issue?
        parsed_output &&
          parsed_output["type"].present? &&
          parsed_output["type"].downcase == "issue"
      end

      def as_issue
        Issue.new(raw_output)
      end

      def valid?
        validator.valid?
      end

      def error
        validator.error
      end

      private

      attr_accessor :raw_output

      def parsed_output
        @parsed_output ||= JSON.parse(raw_output)
      rescue JSON::ParserError
        nil
      end

      def validator
        IssueValidator.new(parsed_output)
      end
    end
  end
end

Version data entries

75 entries across 75 versions & 1 rubygems

Version Path
codeclimate-0.69.0 lib/cc/analyzer/engine_output.rb
codeclimate-0.68.0 lib/cc/analyzer/engine_output.rb
codeclimate-0.67.0 lib/cc/analyzer/engine_output.rb
codeclimate-0.66.0 lib/cc/analyzer/engine_output.rb
codeclimate-0.65.0 lib/cc/analyzer/engine_output.rb
codeclimate-0.64.0 lib/cc/analyzer/engine_output.rb
codeclimate-0.63.7 lib/cc/analyzer/engine_output.rb
codeclimate-0.63.6 lib/cc/analyzer/engine_output.rb
codeclimate-0.63.5 lib/cc/analyzer/engine_output.rb
codeclimate-0.63.4 lib/cc/analyzer/engine_output.rb
codeclimate-0.63.3 lib/cc/analyzer/engine_output.rb
codeclimate-0.63.2 lib/cc/analyzer/engine_output.rb
codeclimate-0.63.1 lib/cc/analyzer/engine_output.rb
codeclimate-0.63.0 lib/cc/analyzer/engine_output.rb
codeclimate-0.62.0 lib/cc/analyzer/engine_output.rb
codeclimate-0.61.1 lib/cc/analyzer/engine_output.rb
codeclimate-0.61.0 lib/cc/analyzer/engine_output.rb
codeclimate-0.60.1 lib/cc/analyzer/engine_output.rb
codeclimate-0.60.0 lib/cc/analyzer/engine_output.rb
codeclimate-0.59.1 lib/cc/analyzer/engine_output.rb