Sha256: 6bdd0109c126977fef2f5315180c0224dda7c8219ae8027a0a56aca1e21556b7

Contents?: true

Size: 897 Bytes

Versions: 46

Compression:

Stored size: 897 Bytes

Contents

require "rubocop"

module Standard
  module Runners
    class Rubocop
      def call(config)
        rubocop_runner = RuboCop::Runner.new(
          config.rubocop_options,
          config.rubocop_config_store
        )

        rubocop_runner.run(config.paths).tap do |success|
          print_errors_and_warnings(success, rubocop_runner)
          print_corrected_code_if_fixing_stdin(config.rubocop_options)
        end
      end

      private

      def print_errors_and_warnings(success, rubocop_runner)
        return unless success

        (rubocop_runner.warnings + rubocop_runner.errors).each do |message|
          warn message
        end
      end

      def print_corrected_code_if_fixing_stdin(rubocop_options)
        return unless rubocop_options[:stdin] && rubocop_options[:auto_correct]

        puts "=" * 20
        print rubocop_options[:stdin]
      end
    end
  end
end

Version data entries

46 entries across 46 versions & 1 rubygems

Version Path
standard-0.12.0 lib/standard/runners/rubocop.rb
standard-0.11.0 lib/standard/runners/rubocop.rb
standard-0.10.2 lib/standard/runners/rubocop.rb
standard-0.10.1 lib/standard/runners/rubocop.rb
standard-0.10.0 lib/standard/runners/rubocop.rb
standard-0.9.0 lib/standard/runners/rubocop.rb
standard-0.8.1 lib/standard/runners/rubocop.rb
standard-0.8 lib/standard/runners/rubocop.rb
standard-0.7 lib/standard/runners/rubocop.rb
standard-0.6.2 lib/standard/runners/rubocop.rb
standard-0.6.1 lib/standard/runners/rubocop.rb
standard-0.6.0 lib/standard/runners/rubocop.rb
standard-0.5.2 lib/standard/runners/rubocop.rb
standard-0.5.1 lib/standard/runners/rubocop.rb
standard-0.5.0 lib/standard/runners/rubocop.rb
standard-0.4.7 lib/standard/runners/rubocop.rb
standard-0.4.6 lib/standard/runners/rubocop.rb
standard-0.4.5 lib/standard/runners/rubocop.rb
standard-0.4.4 lib/standard/runners/rubocop.rb
standard-0.4.3 lib/standard/runners/rubocop.rb