Sha256: 4a1fb8d3c0d6b88d940c0ded1cf6f23b56738a80eca9b1402b1aa8fc28a1c95e

Contents?: true

Size: 999 Bytes

Versions: 9

Compression:

Stored size: 999 Bytes

Contents

# frozen_string_literal: true

require 'simplecov_json_formatter/result_hash_formatter'
require 'simplecov_json_formatter/result_exporter'
require 'json'

module SimpleCov
  module Formatter
    class JSONFormatter
      def format(result)
        result_hash = format_result(result)

        export_formatted_result(result_hash)

        puts output_message(result)
      end

      private

      def format_result(result)
        result_hash_formater = SimpleCovJSONFormatter::ResultHashFormatter.new(result)
        result_hash_formater.format
      end

      def export_formatted_result(result_hash)
        result_exporter = SimpleCovJSONFormatter::ResultExporter.new(result_hash)
        result_exporter.export
      end

      def output_message(result)
        "JSON Coverage report generated for #{result.command_name} to #{SimpleCov.coverage_path}. \
        #{result.covered_lines} / #{result.total_lines} LOC (#{result.covered_percent.round(2)}%) covered."
      end
    end
  end
end

Version data entries

9 entries across 8 versions & 6 rubygems

Version Path
trusty-cms-7.0.9.1 vendor/bundle/ruby/3.1.0/gems/simplecov_json_formatter-0.1.4/lib/simplecov_json_formatter.rb
trusty-cms-7.0.9.1 vendor/bundle/ruby/3.3.0/gems/simplecov_json_formatter-0.1.4/lib/simplecov_json_formatter.rb
minato_ruby_api_client-0.2.2 vendor/bundle/ruby/3.2.0/gems/simplecov_json_formatter-0.1.4/lib/simplecov_json_formatter.rb
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/simplecov_json_formatter-0.1.4/lib/simplecov_json_formatter.rb
op_connect-0.1.2 vendor/bundle/ruby/3.1.0/gems/simplecov_json_formatter-0.1.4/lib/simplecov_json_formatter.rb
simplecov_json_formatter-0.1.4 lib/simplecov_json_formatter.rb
rails_mini_profiler-0.2.0 vendor/bundle/ruby/3.0.0/gems/simplecov_json_formatter-0.1.3/lib/simplecov_json_formatter.rb
simplecov_json_formatter-0.1.3 lib/simplecov_json_formatter.rb
simplecov_json_formatter-0.1.2 lib/simplecov_json_formatter.rb