-
-
Notifications
You must be signed in to change notification settings - Fork 279
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
Always use expect_correction
or expect_no_corrections
when autocorrect is supported
#2052
base: master
Are you sure you want to change the base?
Conversation
…rrect is supported
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.
I expected much more offences after reading the pr’s description 😅
Nice cop, thank you.
@@ -329,6 +329,8 @@ | |||
DESC | |||
end | |||
RUBY | |||
|
|||
expect_no_corrections |
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.
Is this what we want, though? Does it discourage people from implementing autocorrect, or will it work fine as a “placeholder” until autocorrect is implemented.
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 method only useful for cops that implement autocorrect but not for all cases. If someone doesn't implement autocorrect to begin with, there will also be no offense. There's no cop to check for extend AutoCorrector
(;
In this specific case, I think autocorrect could theoretically be implemented but hasn't because heredocs are hard and nobody actually writes tests with heredoc text descriptions.
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.
Yeah, some cops have autocorrect for most cases, but some cases are left to implement later. Maybe we should have an expect_no_corrections_yet
alias for those cases 😆
No, it’s probably fine with the expect_no_corrections
. I guess we’ll only use it for exactly those cases, where it’s theoretically possible to implement autocorrection.
In rubocop/rubocop#13183 I want to add a cop that enforces this automatically. This fixes offenses here in anticipation of that.