Skip to content

Instantly share code, notes, and snippets.

@cemeng
Created August 17, 2016 05:55
Show Gist options
  • Save cemeng/53c522241129f932bb6e129463de4d05 to your computer and use it in GitHub Desktop.
Save cemeng/53c522241129f932bb6e129463de4d05 to your computer and use it in GitHub Desktop.
Run rubocop on files that changed between 2 revisions
unless (ARGV[0] && ARGV[1])
puts "Please specify base revision and end revision, eg: rubocop-diff.rb HEAD 8234531"
exit
end
files = `git diff --name-only #{ARGV[0]} #{ARGV[1]}`.split("\n").join(" ")
puts `rubocop #{files}`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment