Sha256: f91f0b45ac2362809fbc83c9e76164832ae372e3e1b670fcb29306629c3cf61c

Contents?: true

Size: 1.3 KB

Versions: 1

Compression:

Stored size: 1.3 KB

Contents

# frozen_string_literal: true

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

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

module Skunk
  module Command
    # Default command runs a critique using RubyCritic and uses
    # Skunk::Command::StatusReporter to report status
    class Default < RubyCritic::Command::Default
      include Skunk::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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
skunk-0.5.3 lib/skunk/commands/default.rb