Sha256: 0a6e8791e1ed4e85269cdc75dc9a8c5f4f0f4e9b23a64e1378b9919589d52525

Contents?: true

Size: 858 Bytes

Versions: 33

Compression:

Stored size: 858 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

33 entries across 33 versions & 2 rubygems

Version Path
rubycritic-4.9.1 lib/rubycritic/generators/json/simple.rb
rubycritic-4.9.0 lib/rubycritic/generators/json/simple.rb
rubycritic-4.8.1 lib/rubycritic/generators/json/simple.rb
rubycritic-4.8.0 lib/rubycritic/generators/json/simple.rb
rubycritic-4.7.0 lib/rubycritic/generators/json/simple.rb
rubycritic-4.6.1 lib/rubycritic/generators/json/simple.rb
rubycritic-4.6.0 lib/rubycritic/generators/json/simple.rb
rubycritic-4.5.2 lib/rubycritic/generators/json/simple.rb
rubycritic-4.5.1 lib/rubycritic/generators/json/simple.rb
rubycritic-4.5.0 lib/rubycritic/generators/json/simple.rb
rubycritic-4.4.1 lib/rubycritic/generators/json/simple.rb
rubycritic-4.4.0 lib/rubycritic/generators/json/simple.rb
rubycritic-4.3.3 lib/rubycritic/generators/json/simple.rb
rubycritic-4.3.2 lib/rubycritic/generators/json/simple.rb
rubycritic-4.3.1 lib/rubycritic/generators/json/simple.rb
rubycritic-4.3.0 lib/rubycritic/generators/json/simple.rb
rubycritic-4.2.2 lib/rubycritic/generators/json/simple.rb
rubycritic-4.2.1 lib/rubycritic/generators/json/simple.rb
rubycritic-4.2.0 lib/rubycritic/generators/json/simple.rb
rubycritic-simplecov-4.1.1 lib/rubycritic/generators/json/simple.rb