Skip to content

Instantly share code, notes, and snippets.

@aaronklaassen
Last active April 22, 2019 16:51
Show Gist options
  • Save aaronklaassen/158aa22d66e44e021f3f5054312d4382 to your computer and use it in GitHub Desktop.
Save aaronklaassen/158aa22d66e44e021f3f5054312d4382 to your computer and use it in GitHub Desktop.
But you told me you'd never forget!
#!/usr/bin/env ruby
status = `git status -s`
ignore = ["db/schema.rb"]
check = status.split("\n")
.select { |line| ["A", "M"].include?(line[0..1].strip) }
.select { |line| line[-3..-1] == ".rb" }
.map { |line| line[3..-1] }
check -= ignore
ok = system("rubocop -R #{check.join(' ')}")
exit(ok)
@elcuervo
Copy link

Just because bash nerd

git status --porcelain | cut -c4- | grep .rb | xargs bundle exec rubocop -a

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment