Sha256: 0235490823a431b39363246057c20c10c9bd53fc301418c9e76be07b6e1a75de

Contents?: true

Size: 857 Bytes

Versions: 7

Compression:

Stored size: 857 Bytes

Contents

# frozen_string_literal: true
require 'json'
require 'rubycritic/version'
require 'pathname'

module RubyCritic
  module Generator
    module Json
      class Simple
        def initialize(analysed_modules)
          @analysed_modules = analysed_modules
        end

        FILE_NAME = 'report.json'.freeze

        def render
          JSON.dump(data)
        end

        def data
          {
            metadata: {
              rubycritic: {
                version: RubyCritic::VERSION
              }
            },
            analysed_modules: @analysed_modules,
            score: @analysed_modules.score
          }
        end

        def file_directory
          @file_directory ||= Pathname.new(Config.root)
        end

        def file_pathname
          Pathname.new(file_directory).join FILE_NAME
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
rubycritic-3.2.0 lib/rubycritic/generators/json/simple.rb
rubycritic-3.1.3 lib/rubycritic/generators/json/simple.rb
rubycritic-3.1.2 lib/rubycritic/generators/json/simple.rb
rubycritic-3.1.1 lib/rubycritic/generators/json/simple.rb
rubycritic-3.1.0 lib/rubycritic/generators/json/simple.rb
rubycritic-3.0.0 lib/rubycritic/generators/json/simple.rb
rubycritic-2.9.4 lib/rubycritic/generators/json/simple.rb