-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
uninitialized constant DidYouMean::SpellChecker #7979
Comments
Ran into this yesterday (same versions as you). Weird that it should be autoloader in Ruby and it's not doing so 🤔 |
I think the problem has to do with No problem:
Problem:
Why is there no |
I just found this piece in the Ruby source: https://github.com/ruby/ruby/blob/ruby_2_5/gem_prelude.rb ( No problem machine:
Problem machine:
So it seems the real problem is that the |
ruby/did_you_mean#117 seems related. |
Btw, there's a second bug here - If we're blocked by an upstream bug we might just limit the cops that rely on this behaviour to Ruby 2.7+ for the time being. |
Good point. I’ve suggested a fix in #8143. |
In rubocop#7979 it was reported that DidYouMean::SpellChecker may not always be available. We can work around it by doing a feature check before using the SpellChecker class.
In #7979 it was reported that DidYouMean::SpellChecker may not always be available. We can work around it by doing a feature check before using the SpellChecker class. Co-authored-by: Bozhidar Batsov <[email protected]>
TLDR: In c92a591, the name similarity module started using
DidYouMean::SpellChecker
but this gem is not explicitly listed as a dependency.Expected behavior
Rubocop does not crash. We get an offense such as:
Unnecessary disabling of Lint/SuperCoolCop (did you mean Layout/SuperCoolCop?)
Actual behavior
We see the following error when running Rubocop:
Steps to reproduce the problem
Add a magic comment to disable a cop that does not actually exist. E.g.
# rubocop:disable Lint/SuperCoolCop
RuboCop version
The text was updated successfully, but these errors were encountered: