rubocop-git icon indicating copy to clipboard operation
rubocop-git copied to clipboard

Added auto correct with -a flag

Open nicollis opened this issue 9 years ago • 4 comments

added the ability to use rubocop's -a flag and only autocorrect the code that git diff views as added.

it does this by first mapping out the changed lines by some small edits to the patch.rb file

it then takes that those line numbers and adds rubocop en/disable comments to the files around the edited code disabling all other code from being processed by rubocop, while adding lines it maps out what lines its editing

after rubocop runs its validations we then go back though using the edited lines map we remove the added comments. We do this to avoid removing rubocop comments that might already exist in the project

nicollis avatar Apr 02 '16 03:04 nicollis

Yes, please, @m4i !

dhempy avatar Apr 13 '16 13:04 dhempy

yes plz

jmondo avatar Jul 05 '16 18:07 jmondo

Are there plans to add this to the main repo's master branch?

peterwilson avatar Jan 11 '18 16:01 peterwilson

/cc @m4i

dnamsons avatar Sep 30 '18 09:09 dnamsons