Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rubocop only to check modified lines

Tags:

git

ruby

rubocop

I would like to run rubocop on the terminal only for the lines that I have modified within a git versioned project. Currently, from googling, I see scripts which work on the entire modified file.

I found this but what I understand from the documentation is that it shows false positives and negatives.

like image 323
RAbraham Avatar asked Mar 29 '15 12:03

RAbraham


1 Answers

Pronto is gem that can do that - install pronto and pronto-rubocop.

If you want you can use this gist https://gist.github.com/alkuzad/dd729aca36a810892772 that I've used a lot before I was using pronto (it's still handy because pronto is not so flexible about diff). You have to install showlinenum from https://github.com/jay/showlinenum to ~/bin to get it work (or just modify the path in gist)

like image 66
Dawid Gosławski Avatar answered Sep 29 '22 02:09

Dawid Gosławski