Skip to content

Instantly share code, notes, and snippets.

@padi
Last active April 29, 2016 05:18
Show Gist options
  • Save padi/2f0d31fea0749768432a217268cc8d1e to your computer and use it in GitHub Desktop.
Save padi/2f0d31fea0749768432a217268cc8d1e to your computer and use it in GitHub Desktop.
Sane way of slowly following code conventions

Sane way of slowly following code conventions

If you're familiar with bbatsov/ruby-style-guide, you can immediately bbatsov-ize the files you changed in a (current) feature branch:

git diff origin/master --name-status | awk '{print $2}' | xargs rubocop --auto-correct

That roughly transates to: get all changed files in the current feature branch and run each file through rubocop, autocorrecting (modifying) the files if possible.

I recommend saving the changes in a separate commit for easier code reviews.

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