diff --git a/CHANGELOG.md b/CHANGELOG.md index a294b44599c..07257984719 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ * [#8115](https://github.com/rubocop-hq/rubocop/issues/8115): Fix false negative for `Lint::FormatParameterMismatch` when argument contains formatting. ([@andrykonchin][]) * [#8131](https://github.com/rubocop-hq/rubocop/pull/8131): Fix false positive for `Style/RedundantRegexpEscape` with escaped delimiters. ([@owst][]) * [#8124](https://github.com/rubocop-hq/rubocop/issues/8124): Fix a false positive for `Lint/FormatParameterMismatch` when using named parameters with escaped `%`. ([@koic][]) +* [#7979](https://github.com/rubocop-hq/rubocop/issues/7979): Fix "uninitialized constant DidYouMean::SpellChecker" exception. ([@bquorning][]) * [#8098](https://github.com/rubocop-hq/rubocop/issues/8098): Fix a false positive for `Style/RedundantRegexpCharacterClass` when using interpolations. ([@owst][]) ## 0.85.1 (2020-06-07) diff --git a/lib/rubocop/name_similarity.rb b/lib/rubocop/name_similarity.rb index 917d87bd2f8..8cf0b9a1161 100644 --- a/lib/rubocop/name_similarity.rb +++ b/lib/rubocop/name_similarity.rb @@ -12,6 +12,12 @@ def find_similar_name(target_name, names) end def find_similar_names(target_name, names) + # DidYouMean::SpellChecker is not available in all versions of Ruby, and + # even on versions where it *is* available (>= 2.3), it is not always + # required correctly. So we do a feature check first. + # See: https://github.com/rubocop-hq/rubocop/issues/7979 + return [] unless defined?(DidYouMean::SpellChecker) + names = names.dup names.delete(target_name)