Sha256: 12fad108edc43714eb2678501051a2e8b2464c7738a887fec5ce0d715ffbcef3

Contents?: true

Size: 789 Bytes

Versions: 18

Compression:

Stored size: 789 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)
          return unless data.present?

          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

18 entries across 18 versions & 1 rubygems

Version Path
codeclimate-0.9.0 lib/cc/analyzer/formatters/json_formatter.rb
codeclimate-0.8.1 lib/cc/analyzer/formatters/json_formatter.rb
codeclimate-0.8.0 lib/cc/analyzer/formatters/json_formatter.rb
codeclimate-0.7.2 lib/cc/analyzer/formatters/json_formatter.rb
codeclimate-0.7.0 lib/cc/analyzer/formatters/json_formatter.rb
codeclimate-0.6.4 lib/cc/analyzer/formatters/json_formatter.rb
codeclimate-0.6.3 lib/cc/analyzer/formatters/json_formatter.rb
codeclimate-0.6.2 lib/cc/analyzer/formatters/json_formatter.rb
codeclimate-0.6.1 lib/cc/analyzer/formatters/json_formatter.rb
codeclimate-0.6.0 lib/cc/analyzer/formatters/json_formatter.rb
codeclimate-0.5.0 lib/cc/analyzer/formatters/json_formatter.rb
codeclimate-0.4.4 lib/cc/analyzer/formatters/json_formatter.rb
codeclimate-0.4.3 lib/cc/analyzer/formatters/json_formatter.rb
codeclimate-0.4.1 lib/cc/analyzer/formatters/json_formatter.rb
codeclimate-0.4.0 lib/cc/analyzer/formatters/json_formatter.rb
codeclimate-0.3.2 lib/cc/analyzer/formatters/json_formatter.rb
codeclimate-0.3.1 lib/cc/analyzer/formatters/json_formatter.rb
codeclimate-0.3.0 lib/cc/analyzer/formatters/json_formatter.rb