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

Rename custom rake task to rubocop:autocorrect #10709

Merged

Conversation

koic
Copy link
Member

@koic koic commented Jun 11, 2022

Follow up #10547.

This PR renames custom rake task from rubocop:auto_correct to rubocop:autocorrect.

Before

rake rubocop                              # Run RuboCop
rake rubocop:auto_correct                 # Autocorrect RuboCop offenses

After

rake rubocop                             # Run RuboCop
rake rubocop:autocorrect                 # Autocorrect RuboCop offenses

For compatibility, rubocop:auto_correct task is left, but the task is deprecated and does not display in rake -T.
When executed, the following warning will be displayed:

% bundle exec rake rubocop:auto_correct
rubocop:auto_correct task is deprecated; use rubocop:autocorrect task instead.
Running RuboCop...

Before submitting the PR make sure the following are checked:

  • The PR relates to only one subject with a clear title and description in grammatically correct, complete sentences.
  • Wrote good commit messages.
  • Commit message starts with [Fix #issue-number] (if the related issue exists).
  • Feature branch is up-to-date with master (if not - rebase it).
  • Squashed related commits together.
  • Added tests.
  • Ran bundle exec rake default. It executes all tests and runs RuboCop on its own code.
  • Added an entry (file) to the changelog folder named {change_type}_{change_description}.md if the new code introduces user-observable changes. See changelog entry format for details.

Follow up rubocop#10547.

This PR renames custom rake task from `rubocop:auto_correct`
to `rubocop:autocorrect`.

## Before

```console
rake rubocop                              # Run RuboCop
rake rubocop:auto_correct                 # Autocorrect RuboCop offenses
```

## After

```console
rake rubocop                             # Run RuboCop
rake rubocop:autocorrect                 # Autocorrect RuboCop offenses
```

For compatibility, `rubocop:auto_correct` task is left, but the task is
deprecated and does not display in `rake -T`.

When executed, the following warning will be displayed:

```console
% bundle exec rake rubocop:auto_correct
rubocop:auto_correct task is deprecated; use rubocop:autocorrect task instead.
Running RuboCop...
```
@koic koic force-pushed the rename_custom_rake_task_to_rubocop_autocorrect branch from 1b6f2c1 to 742f3e4 Compare June 11, 2022 05:56
@bbatsov bbatsov merged commit 1bf2dd8 into rubocop:master Jun 11, 2022
@bbatsov
Copy link
Collaborator

bbatsov commented Jun 11, 2022

Thanks!

@koic koic deleted the rename_custom_rake_task_to_rubocop_autocorrect branch June 11, 2022 16:22

task(:auto_correct, *args) do |_, task_args|
desc 'Autocorrect RuboCop offenses'
task(:autocorrect, *args) do |_, task_args|
RakeFileUtils.verbose(verbose) do
yield(*[self, task_args].slice(0, task_block.arity)) if task_block
options = full_options.unshift('--autocorrect-all')

Choose a reason for hiding this comment

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

When I saw this PR, I was hoping that the rake task would now default to safe auto corrects only.

Choose a reason for hiding this comment

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

@bbatsov Since this has been merged, but not been released yet, how would you feel about a new PR that adds a rubocop:autocorrect_all task?

The deprecated rubocop:auto_correct task could invoke this one, and the new rubocop:autocorrect could be changed to do safe changes only?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I'd be fine with this.

Copy link
Member Author

Choose a reason for hiding this comment

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

I've opened #10746 to solve it.

koic added a commit to koic/rubocop that referenced this pull request Jun 24, 2022
…correct_all`

Follow up rubocop#10709 (comment).

This PR splits deprecated `rubocop:auto_correct` custom rake task
into `rubocop:autocorrect` and `rubocop:autocorrect_all`.
bbatsov pushed a commit that referenced this pull request Jun 24, 2022
…correct_all`

Follow up #10709 (comment).

This PR splits deprecated `rubocop:auto_correct` custom rake task
into `rubocop:autocorrect` and `rubocop:autocorrect_all`.
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

3 participants