Skip to content

Instantly share code, notes, and snippets.

@t-cyrill
Created June 11, 2014 04:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save t-cyrill/3bc1e510a4dcd45f6f5a to your computer and use it in GitHub Desktop.
Save t-cyrill/3bc1e510a4dcd45f6f5a to your computer and use it in GitHub Desktop.
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