Sha256: 7ce53602c36df1938afc5bd096d74aa7fadd8221f229d0102c9856e6c724076a

Contents?: true

Size: 692 Bytes

Versions: 4

Compression:

Stored size: 692 Bytes

Contents

# frozen_string_literal: true

require "refinements/io"
require "refinements/pathname"
require "rubocop"

module Rubysmith
  module Extensions
    # Ensures project skeleton adheres to style guide.
    class Rubocop
      include Import[:settings]

      using Refinements::IO
      using Refinements::Pathname

      def initialize(client: ::RuboCop::CLI.new, **)
        @client = client
        super(**)
      end

      def call
        project_root = settings.project_root

        project_root.change_dir do
          STDOUT.squelch { client.run ["--autocorrect-all", project_root.to_s] }
        end

        true
      end

      private

      attr_reader :client
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rubysmith-7.3.0 lib/rubysmith/extensions/rubocop.rb
rubysmith-7.2.0 lib/rubysmith/extensions/rubocop.rb
rubysmith-7.1.0 lib/rubysmith/extensions/rubocop.rb
rubysmith-7.0.0 lib/rubysmith/extensions/rubocop.rb