Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Fixes #8156] CLI options change: auto-correct now safe by default. #8192

Merged
merged 1 commit into from Jun 24, 2020

Conversation

marcandre
Copy link
Contributor

I'm proposing slightly different options than in #8156:

-a / --auto-correct are now safe only, replacing --safe-auto-correct
-A / --auto-correct-all apply safe and unsafe corrections

Help reads:

...
-a, --auto-correct               Auto-correct offenses (only when it's safe).
-A, --auto-correct-all           Auto-correct offenses (safe and unsafe)
...

@koic
Copy link
Member

koic commented Jun 23, 2020

I think this is a practical change, and -a and -A are easy to understand 👍
Could you add a changelog entry to mention to users that -a option's default behavior is a breaking change?

If this is a breaking change, mark it with **(Breaking)**.

https://github.com/rubocop-hq/rubocop/blob/master/CONTRIBUTING.md#changelog-entry-format

@bbatsov
Copy link
Collaborator

bbatsov commented Jun 23, 2020

Might be a good idea to keep the old option around with some deprecation message, or at least show a message when people try to invoke it.

@marcandre marcandre force-pushed the safetyfirst branch 4 times, most recently from 6ab4941 to 86b0328 Compare June 23, 2020 14:34
@marcandre
Copy link
Contributor Author

I've added back "--safe-autocorrect" with a warning "--safe-autocorrect is deprecated; use --autocorrect".
Changelog entry added too.

CHANGELOG.md Outdated Show resolved Hide resolved
@bbatsov
Copy link
Collaborator

bbatsov commented Jun 23, 2020

You should also update https://docs.rubocop.org/rubocop/0.86/usage/auto_correct.html

…ault.

`-a` / `--auto-correct` are now safe only, replacing `--safe-auto-correct`
`-A` / `--auto-correct-all` apply safe and unsafe corrections
@marcandre
Copy link
Contributor Author

You should also update https://docs.rubocop.org/rubocop/0.86/usage/auto_correct.html

Oops, right. Done.

@bbatsov bbatsov merged commit e090897 into rubocop:master Jun 24, 2020
@bbatsov
Copy link
Collaborator

bbatsov commented Jun 24, 2020

Thanks!

@@ -69,7 +69,7 @@ def setup_subtasks(name, *args, &task_block)
task(:auto_correct, *args) do |_, task_args|
RakeFileUtils.verbose(verbose) do
yield(*[self, task_args].slice(0, task_block.arity)) if block_given?
options = full_options.unshift('--auto-correct')
options = full_options.unshift('--auto-correct-all')

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bbatsov Hi! Given the name of this task and the change to the behaviour of the command line option to be 'safe' changes only, should the rake task have been changed to doing safe changes only too (by not changing this line)?

Thanks.

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.

None yet

4 participants