Sha256: 1bdb8c9466b8cc9ea6359afb5587e07d8881d9cd4a635c1fd67ccfaa4b9d14bb

Contents?: true

Size: 750 Bytes

Versions: 7

Compression:

Stored size: 750 Bytes

Contents

module CC
  module Analyzer
    module Formatters
      class JSONFormatter < Formatter

        def initialize(filesystem)
          @filesystem = filesystem
          @has_begun = false
        end

        def started
          print "["
        end

        def finished
          print "]\n"
        end

        def write(data)
          document = JSON.parse(data)
          document["engine_name"] = current_engine.name

          if @has_begun
            print ",\n"
          end

          print document.to_json
          @has_begun = true
        end

        def failed(output)
          $stderr.puts "\nAnalysis failed with the following output:"
          $stderr.puts output
          exit 1
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
codeclimate-0.9.7 lib/cc/analyzer/formatters/json_formatter.rb
codeclimate-0.9.6 lib/cc/analyzer/formatters/json_formatter.rb
codeclimate-0.9.5 lib/cc/analyzer/formatters/json_formatter.rb
codeclimate-0.9.4 lib/cc/analyzer/formatters/json_formatter.rb
codeclimate-0.9.3 lib/cc/analyzer/formatters/json_formatter.rb
codeclimate-0.9.2 lib/cc/analyzer/formatters/json_formatter.rb
codeclimate-0.9.1 lib/cc/analyzer/formatters/json_formatter.rb