misogi / vscode-ruby-rubocop

Rubocop extension for Visual Studio Code
https://marketplace.visualstudio.com/items/misogi.ruby-rubocop
MIT License
137 stars 68 forks source link

Switch to --auto-correct-all #127

Closed AlecRust closed 4 years ago

AlecRust commented 4 years ago

Please see https://github.com/misogi/vscode-ruby-rubocop/issues/123, https://github.com/misogi/vscode-ruby-rubocop/issues/101.

mgonc commented 4 years ago

https://github.com/rubocop-hq/rubocop/blob/master/CHANGELOG.md#0870-2020-07-06

ngouy commented 4 years ago

With newer version of rubocop (0.92) and fix about the json output (see https://github.com/misogi/vscode-ruby-rubocop/issues/129), I don't have any issue (all my files have a frozen_string_literal: true and auto correct is working). Why must we run also unsafe corrections? I feel like auto correct unsafe corrections is, well, not safe, its more of an improvement.

Why is it a requirement?

Maybe we can try to add on option in the extension settings to toggle this behaviour?

AlecRust commented 4 years ago

@ngouy I agree it would be better to add an option for this. This PR fixes the behaviour to before the Rubocop change, but perhaps no longer necessary.

I don't have any issue (all my files have a frozen_string_literal: true and auto correct is working).

Strange, my understanding was this cop was unsafe in terms of autocorrect (https://github.com/rubocop-hq/rubocop/pull/8529).

ngouy commented 4 years ago

Maybe I didn't quite understand the issue with the frize_string_litteral thing. Is the issue that you expect it to be autocorrected when you don't have it in your file? Or is the issue that when you have it the autocorrect doesn't works for other policies?

Or asked otherwise : What is broken that this PR fix. Is that "just" that autoccorect only correct safe policies now or is there a real underlying bug? (thought it was to fix this : https://github.com/misogi/vscode-ruby-rubocop/issues/123#issuecomment-703136393)

As you said yourself in #101 maybe the real "fix" (if there is no bug) may be to add an option.

AlecRust commented 4 years ago

Is the issue that you expect it to be autocorrected when you don't have it in your file?

Yes. This was the behaviour I experienced before this regression (caused by new Rubocop release).

ngouy commented 4 years ago

It's a kinda messy in last issues, some duplicates and sometimes many different bugs in a single one issue ^^' Hard to understand it all

misogi commented 4 years ago

Could you add an option (ex: safeAutoCorrect) that toggles --auto-correct or --auto-correct-all?

https://docs.rubocop.org/rubocop/usage/auto_correct.html