Skip to content

Commit

Permalink
Revert "Sync did_you_mean"
Browse files Browse the repository at this point in the history
This reverts commit 946dadd,
which broke `TestGemRequire` and others.
  • Loading branch information
nobu committed May 12, 2020
1 parent 317fdd6 commit ee518cf
Show file tree
Hide file tree
Showing 6 changed files with 2 additions and 80 deletions.
4 changes: 1 addition & 3 deletions lib/did_you_mean.rb
Expand Up @@ -6,7 +6,6 @@
require_relative 'did_you_mean/spell_checkers/method_name_checker'
require_relative 'did_you_mean/spell_checkers/key_error_checker'
require_relative 'did_you_mean/spell_checkers/null_checker'
require_relative 'did_you_mean/spell_checkers/require_path_checker'
require_relative 'did_you_mean/formatters/plain_formatter'
require_relative 'did_you_mean/tree_spell_checker'

Expand Down Expand Up @@ -96,9 +95,8 @@ def self.correct_error(error_class, spell_checker)
correct_error NameError, NameErrorCheckers
correct_error KeyError, KeyErrorChecker
correct_error NoMethodError, MethodNameChecker
correct_error LoadError, RequirePathChecker

# Returns the currently set formatter. By default, it is set to +DidYouMean::Formatter+.
# Returns the currenctly set formatter. By default, it is set to +DidYouMean::Formatter+.
def self.formatter
@@formatter
end
Expand Down
7 changes: 1 addition & 6 deletions lib/did_you_mean/spell_checkers/method_name_checker.rb
Expand Up @@ -43,12 +43,7 @@ def initialize(exception)
end

def corrections
@corrections ||= begin
dictionary = method_names
dictionary = RB_RESERVED_WORDS + dictionary if @private_call

SpellChecker.new(dictionary: dictionary).correct(method_name) - names_to_exclude
end
@corrections ||= SpellChecker.new(dictionary: RB_RESERVED_WORDS + method_names).correct(method_name) - names_to_exclude
end

def method_names
Expand Down
33 changes: 0 additions & 33 deletions lib/did_you_mean/spell_checkers/require_path_checker.rb

This file was deleted.

7 changes: 0 additions & 7 deletions test/did_you_mean/spell_checking/test_method_name_check.rb
Expand Up @@ -137,11 +137,4 @@ def test_suggests_yield
assert_correction :yield, error.corrections
assert_match "Did you mean? yield", error.to_s
end

def test_does_not_suggest_yield
error = assert_raise(NoMethodError) { 1.yeild }

assert_correction [], error.corrections
assert_not_match(/Did you mean\? +yield/, error.to_s)
end if RUBY_ENGINE != "jruby"
end
30 changes: 0 additions & 30 deletions test/did_you_mean/spell_checking/test_require_path_check.rb

This file was deleted.

1 change: 0 additions & 1 deletion test/did_you_mean/test_verbose_formatter.rb
Expand Up @@ -3,7 +3,6 @@
class VerboseFormatterTest < Test::Unit::TestCase
def setup
require_relative File.join(DidYouMean::TestHelper.root, 'verbose')

DidYouMean.formatter = DidYouMean::VerboseFormatter.new
end

Expand Down

0 comments on commit ee518cf

Please sign in to comment.