Sha256: 782a9a97425469cec6d63c3a7a1b9f4ca623531fc059299610b5f97e3159291e

Contents?: true

Size: 713 Bytes

Versions: 1

Compression:

Stored size: 713 Bytes

Contents

require 'multi_rubocops/version'
require 'rake'
require 'thread'
require 'rspec/core'
require 'rspec/core/rake_task'
require 'rubocop/rake_task'
#TODO: Compile output into human readable
module MultiRubocops
  def self.call
    root_folder = Dir.pwd
    output = []
    threads = procdir(root_folder).map do |files|
      Thread.new(files) do |file|
        puts "thread: #{file}"
        output << `rubocop #{files}`
      end
    end
    threads.each(&:join)
    puts output
  end

  def self.procdir(dir)
    Dir[File.join(dir, '**', '*')].reject { |p| File.directory? p }
  end

  def self.call_single_thread
    root_folder = Dir.pwd
    procdir(root_folder)
    output = `rubocop`
    puts output
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
multi_rubocops-0.1.0 lib/multi_rubocops.rb