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.59.0 lib/cc/analyzer/engine_output.rb
codeclimate-0.58.0 lib/cc/analyzer/engine_output.rb
codeclimate-0.57.0 lib/cc/analyzer/engine_output.rb
codeclimate-0.56.0 lib/cc/analyzer/engine_output.rb
codeclimate-0.55.0 lib/cc/analyzer/engine_output.rb
codeclimate-0.54.0 lib/cc/analyzer/engine_output.rb
codeclimate-0.53.0 lib/cc/analyzer/engine_output.rb
codeclimate-0.52.0 lib/cc/analyzer/engine_output.rb
codeclimate-0.51.3 lib/cc/analyzer/engine_output.rb
codeclimate-0.51.2 lib/cc/analyzer/engine_output.rb
codeclimate-0.51.1 lib/cc/analyzer/engine_output.rb
codeclimate-0.51.0 lib/cc/analyzer/engine_output.rb
codeclimate-0.50.0 lib/cc/analyzer/engine_output.rb
codeclimate-0.49.0 lib/cc/analyzer/engine_output.rb
codeclimate-0.48.0 lib/cc/analyzer/engine_output.rb
codeclimate-0.47.0 lib/cc/analyzer/engine_output.rb
codeclimate-0.46.0 lib/cc/analyzer/engine_output.rb
codeclimate-0.45.0 lib/cc/analyzer/engine_output.rb
codeclimate-0.44.0 lib/cc/analyzer/engine_output.rb
codeclimate-0.43.1 lib/cc/analyzer/engine_output.rb