Skip to content

Conversation

@nicollis
Copy link

@nicollis nicollis commented Apr 2, 2016

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

@dhempy
Copy link

dhempy commented Apr 13, 2016

Yes, please, @m4i !

@jmondo
Copy link

jmondo commented Jul 5, 2016

yes plz

durandom added a commit to durandom/rubocop-git that referenced this pull request Mar 17, 2017
Added auto correct with -a flag
durandom added a commit to durandom/rubocop-git that referenced this pull request May 2, 2017
Added auto correct with -a flag
@rgould rgould mentioned this pull request Nov 13, 2017
@peterwilson
Copy link

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

@dnamsons
Copy link

/cc @m4i

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants