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.43.0 lib/cc/analyzer/engine_output.rb
codeclimate-0.42.1 lib/cc/analyzer/engine_output.rb
codeclimate-0.42.0 lib/cc/analyzer/engine_output.rb
codeclimate-0.41.0 lib/cc/analyzer/engine_output.rb
codeclimate-0.40.3 lib/cc/analyzer/engine_output.rb
codeclimate-0.40.2 lib/cc/analyzer/engine_output.rb
codeclimate-0.40.1 lib/cc/analyzer/engine_output.rb
codeclimate-0.40.0 lib/cc/analyzer/engine_output.rb
codeclimate-0.39.0 lib/cc/analyzer/engine_output.rb
codeclimate-0.38.1 lib/cc/analyzer/engine_output.rb
codeclimate-0.38.0 lib/cc/analyzer/engine_output.rb
codeclimate-0.37.0 lib/cc/analyzer/engine_output.rb
codeclimate-0.36.0 lib/cc/analyzer/engine_output.rb
codeclimate-0.35.2 lib/cc/analyzer/engine_output.rb
codeclimate-0.35.1 lib/cc/analyzer/engine_output.rb
codeclimate-0.35.0 lib/cc/analyzer/engine_output.rb
codeclimate-0.34.1 lib/cc/analyzer/engine_output.rb
codeclimate-0.34.0 lib/cc/analyzer/engine_output.rb
codeclimate-0.33.0 lib/cc/analyzer/engine_output.rb
codeclimate-0.32.1 lib/cc/analyzer/engine_output.rb