If you’ve got a CI server checking that your Ruby code matches your Rubocop specifications, you want copstop.
Before you commit run copstop -n
(-n
for “new” files). It’ll run
rubocop -A
on anything that ends with .rb
.
If you committed, but haven’t pushed yet, run copstop -l
(-l
for
“last” commit). And it’ll run the same command againts all the .rb
files that were part of that commit.
Note that the -A
option to Rubocop means it’ll attept to autocorrect
all offenses (safe and unsafe). Edit the file and change this to -a
if you’d prefer
it to only do the “safe” changes.
ProTip: if you’re using a git hook manager like lefthook or git-rook you should be able to have it run it as a pre-commit hook. ;)
please specify -n or -l
Usage: copstop [-n|-l]
-n files changed since the last commit
-l files changed in the last commit
Metadata:
Tags: