diff --git a/CHANGELOG.md b/CHANGELOG.md index 44954c4c86d..c6b79032ec3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ ## master (unreleased) +### Bug fixes + +* [#8252](https://github.com/rubocop-hq/rubocop/issues/8252): Fix a command line option name from `--safe-autocorrect` to `--safe-auto-correct`, which is compatible with RuboCop 0.66 and lower. ([@koic][]) + ## 0.87.0 (2020-07-06) ### New features diff --git a/lib/rubocop/options.rb b/lib/rubocop/options.rb index 105dc25b8eb..9697fc68a50 100644 --- a/lib/rubocop/options.rb +++ b/lib/rubocop/options.rb @@ -174,8 +174,8 @@ def add_boolean_flags(opts) option(opts, '-a', '--auto-correct') do @options[:safe_auto_correct] = true end - option(opts, '--safe-autocorrect') do - warn '--safe-autocorrect is deprecated; use --autocorrect' + option(opts, '--safe-auto-correct') do + warn '--safe-auto-correct is deprecated; use --auto-correct' @options[:safe_auto_correct] = @options[:auto_correct] = true end option(opts, '-A', '--auto-correct-all') do @@ -472,7 +472,7 @@ module OptionsHelp safe: 'Run only safe cops.', list_target_files: 'List all files RuboCop will inspect.', auto_correct: 'Auto-correct offenses (only when it\'s safe).', - safe_autocorrect: '(same, deprecated)', + safe_auto_correct: '(same, deprecated)', auto_correct_all: 'Auto-correct offenses (safe and unsafe)', fix_layout: 'Run only layout cops, with auto-correct on.', color: 'Force color output on or off.', diff --git a/spec/rubocop/options_spec.rb b/spec/rubocop/options_spec.rb index 93ee20514b5..b3cbb37750e 100644 --- a/spec/rubocop/options_spec.rb +++ b/spec/rubocop/options_spec.rb @@ -115,7 +115,7 @@ def abs(path) -E, --extra-details Display extra details in offense messages. -S, --display-style-guide Display style guide URLs in offense messages. -a, --auto-correct Auto-correct offenses (only when it's safe). - --safe-autocorrect (same, deprecated) + --safe-auto-correct (same, deprecated) -A, --auto-correct-all Auto-correct offenses (safe and unsafe) --disable-pending-cops Run without pending cops. --enable-pending-cops Run with pending cops. @@ -372,9 +372,9 @@ def abs(path) end end - describe '--safe-autocorrect' do + describe '--safe-auto-correct' do it 'is a deprecated alias' do - expect { options.parse %w[--safe-autocorrect] } + expect { options.parse %w[--safe-auto-correct] } .to output(/deprecated/).to_stderr end end