Sha256: 902d89c08a201d24b77d6ddd02a0d53f6c153d83826c8a06391049c0bcc7d69c

Contents?: true

Size: 914 Bytes

Versions: 25

Compression:

Stored size: 914 Bytes

Contents

# frozen_string_literal: true

require 'rubycritic/source_control_systems/base'
require 'rubycritic/analysers_runner'
require 'rubycritic/revision_comparator'
require 'rubycritic/reporter'
require 'rubycritic/commands/base'

module RubyCritic
  module Command
    class Default < Base
      def initialize(options)
        super
        @paths = options[:paths] || ['.']
        Config.source_control_system = SourceControlSystem::Base.create
      end

      def execute
        report(critique)
        status_reporter
      end

      def critique
        analysed_modules = AnalysersRunner.new(paths).run
        RevisionComparator.new(paths).statuses = analysed_modules
      end

      def report(analysed_modules)
        Reporter.generate_report(analysed_modules)
        status_reporter.score = analysed_modules.score
      end

      private

      attr_reader :paths, :status_reporter
    end
  end
end

Version data entries

25 entries across 25 versions & 2 rubygems

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