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 #10384
Update auto-gen-config's comment re auto-correct #10384
Conversation
The auto-gen-config output will say "Cop supports --auto-correct" for cops which do not support --auto-correct, but which do support --auto-correct-all. Let's update the output to reflect that. When someone is working on the todo list, this can be helpful information to have at hand. I'll often run something like: `bin/rubocop --only Style/StringConcatenation -a` and then realize actually that won't work, and this would save me a few seconds.
todo_contents = File.read('.rubocop_todo.yml').lines[8..-1].join | ||
expect(todo_contents).to eq(<<~YAML) | ||
# Offense count: 1 | ||
# Cop supports --auto-correct-all. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this line is the relevant assertion. Other examples would say --auto-correct
instead of --auto-correct-all
I'm fine with the proposed changes, even if I'm starting to get confused by our own terminology. I had forgotten that we made |
Thanks for merging! I tend to agree :) #10414 |
…: 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.
…: false` 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: ```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.
The auto-gen-config output will say "Cop supports --auto-correct" for
cops which do not support --auto-correct, but which do support
--auto-correct-all. Let's update the output to reflect that. When
someone is working on the todo list, this can be helpful information to
have at hand.
I'll often run something like:
bin/rubocop --only Style/StringConcatenation -a
and then realizeactually that won't work, and this would save me a few seconds.
Hi there. This is my first contribution in a few years. Happy to be back. WDYT about this idea?
Unfortunately
bundle exec rake default
is failing for me locally with this test failure, which is unrelated to my change:Failure
Before submitting the PR make sure the following are checked:
[Fix #issue-number]
(if the related issue exists).master
(if not - rebase it).bundle exec rake default
. It executes all tests and runs RuboCop on its own code.{change_type}_{change_description}.md
if the new code introduces user-observable changes. See changelog entry format for details.