Skip to content

Instantly share code, notes, and snippets.

@teeparham
Last active December 11, 2015 01:28
Show Gist options
  • Select an option

  • Save teeparham/a1df95db23d0e493255a to your computer and use it in GitHub Desktop.

Select an option

Save teeparham/a1df95db23d0e493255a to your computer and use it in GitHub Desktop.
Inspect all ruby files in the current commit with rubocop
alias gdcop="git diff --name-only | grep '\.rb' | tr '\n' ' ' | sed 's/,$/\n/' | xargs rubocop"
# $ git status
# On branch master
# Your branch is up-to-date with 'origin/master'.
# Changes not staged for commit:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# modified: History.md
# modified: lib/rgeo/geo_json.rb
# modified: lib/rgeo/geo_json/coder.rb
#
# no changes added to commit (use "git add" and/or "git commit -a")
# $ gdcop
# Inspecting 2 files
# ...
# gdcop -a
# autocorrects 2 files ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment