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

Always use expect_correction or expect_no_corrections when autocorrect is supported #2052

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Earlopain
Copy link
Contributor

In rubocop/rubocop#13183 I want to add a cop that enforces this automatically. This fixes offenses here in anticipation of that.

@Earlopain Earlopain requested a review from a team as a code owner February 25, 2025 17:20
Copy link
Member

@pirj pirj left a 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
Copy link
Collaborator

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.

Copy link
Contributor Author

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.

Copy link
Collaborator

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.

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.

3 participants