Sha256: 964a11029d62f2c8f98bd361e9b014a5912273925a69358e75dba6d1754c24cf

Contents?: true

Size: 1.39 KB

Versions: 2

Compression:

Stored size: 1.39 KB

Contents

# frozen_string_literal: true

require "rubycritic/commands/default"
require "rubycritic/analysers_runner"
require "rubycritic/revision_comparator"
require "rubycritic/reporter"

require "skunk/cli/commands/base"
require "skunk/cli/commands/shareable"
require "skunk/cli/commands/status_reporter"

module Skunk
  module Cli
    module Command
      # Default command runs a critique using RubyCritic and uses
      # Skunk::Command::StatusReporter to report status
      class Default < RubyCritic::Command::Default
        include Skunk::Cli::Command::Shareable

        def initialize(options)
          super
          @options = options
          @status_reporter = Skunk::Command::StatusReporter.new(options)
        end

        # It generates a report and it returns an instance of
        # Skunk::Command::StatusReporter
        #
        # @return [Skunk::Command::StatusReporter]
        def execute
          RubyCritic::Config.formats = []

          report(critique)

          status_reporter
        end

        # It connects the Skunk::Command::StatusReporter with the collection
        # of analysed modules.
        #
        # @param [RubyCritic::AnalysedModulesCollection] A collection of analysed modules
        def report(analysed_modules)
          status_reporter.analysed_modules = analysed_modules
          status_reporter.score = analysed_modules.score
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
skunk-0.5.2 lib/skunk/cli/commands/default.rb
skunk-0.5.1 lib/skunk/cli/commands/default.rb