class RuboCop::Cop::Rails::UnknownEnv
def message(name)
def message(name) name = name.to_s.chomp('?') # 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/rubocop/issues/7979 similar_names = if defined?(DidYouMean::SpellChecker) spell_checker = DidYouMean::SpellChecker.new(dictionary: environments) spell_checker.correct(name) else [] end if similar_names.empty? format(MSG, name: name) else format(MSG_SIMILAR, name: name, similar: similar_names.join(', ')) end end