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

Update auto-gen-config's comment re auto-correct for SafeAutoCorrect: false #10673

Merged
merged 1 commit into from May 31, 2022

Conversation

ydah
Copy link
Member

@ydah ydah commented May 26, 2022

This PR is enhancement: #10384

The auto-gen-config output will say "Cop supports --auto-correct".
However, Cop with SafeAutoCorrect: false outputs the same as follows:

# This cop supports safe auto-correction (--auto-correct).
# Configuration parameters: EnforcedStyle.
# SupportedStyles: always, always_true, never
Style/FrozenStringLiteralComment:

We'll want to execute the following commands when we see it.

bundle exec rubocop --auto-correct foo.rb

However, it is not automatically corrected.

Offenses:

foo.rb:1:1: C: [Correctable] Style/FrozenStringLiteralComment: Missing frozen string literal comment.
something
^

1 file inspected, 1 offenses detected, 1 more offenses can be corrected with `rubocop -A`

So, we should suggest --auto-correct-all for SafeAutoCorrect: false Cop as well.


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.

@ydah ydah marked this pull request as ready for review May 26, 2022 23:30
@nobuyo
Copy link
Contributor

nobuyo commented May 26, 2022

The method names auto_correct and autocorrect are mixed up. I think it would be better to unify autocorrect for new defined method at least.

@ydah
Copy link
Member Author

ydah commented May 26, 2022

The method names auto_correct and autocorrect are mixed up. I think it would be better to unify autocorrect for new defined method at least.

Indeed it is. I've standardized on autocorrect.

@ydah ydah force-pushed the auto_gen_config_unsafe branch 2 times, most recently from e519ace to b8d72f9 Compare May 27, 2022 04:02
…: false`

This PR is enhancement: rubocop#10384

The auto-gen-config output will say "Cop supports --auto-correct".
However, Cop with `SafeAutoCorrect: false`
outputs the same as follows:

```yaml
# This cop supports safe auto-correction (--auto-correct).
# Configuration parameters: EnforcedStyle.
# SupportedStyles: always, always_true, never
Style/FrozenStringLiteralComment:
```

We'll want to execute the following commands
when we see it.

```
bundle exec rubocop --auto-correct foo.rb
```

However, it is not automatically corrected.

```
Offenses:

foo.rb:1:1: C: [Correctable] Style/FrozenStringLiteralComment: Missing frozen string literal comment.
[2, 1, 3].sort.first
^

1 file inspected, 5 offenses detected, 5 more offenses can be corrected with `rubocop -A`
```

So, we should suggest --auto-correct-all
for `SafeAutoCorrect: false` Cop as well.
@bbatsov bbatsov merged commit c40b99e into rubocop:master May 31, 2022
@bbatsov
Copy link
Collaborator

bbatsov commented May 31, 2022

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

3 participants