Skip to content

Instantly share code, notes, and snippets.

@t-cyrill
Created Jun 11, 2014
Embed
What would you like to do?
test:
override:
- "bundle exec bin/rubocop_parallel": { parallel: true }
#!/usr/bin/env ruby
require 'rubocop'
require 'yaml'
Dir.chdir File.expand_path('../..', __FILE__)
config = YAML.load_file '.rubocop.yml'
files = Dir.glob '**/*.rb'
files += Dir.glob config['AllCops']['Include']
files -= Dir.glob config['AllCops']['Exclude']
files.sort!.uniq!
node = (ENV['CIRCLE_NODE_INDEX'] || 0).to_i
total = (ENV['CIRCLE_NODE_TOTAL'] || 1).to_i
files = files.select.with_index { |_file, i| i % total == node }
puts "Running RuboCop on node #{node + 1} of #{total}"
exit RuboCop::CLI.new.run(files)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment