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

[Fix #8252] Fix a typo for --safe-auto-correct command line option #8254

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions lib/rubocop/options.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.',
Expand Down
6 changes: 3 additions & 3 deletions spec/rubocop/options_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down