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

Remove experimental features #135

Merged
merged 1 commit into from
Nov 18, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ rvm:
- jruby-head

matrix:
include:
- rvm: 2.6.0
script:
- bundle exec rake test:accuracy
- bundle exec rake test:explore
- bundle exec rake benchmark:memory
#include:
# - rvm: 2.6.0
# script:
# - bundle exec rake test:accuracy
# - bundle exec rake test:explore
# - bundle exec rake benchmark:memory

allow_failures:
- rvm: jruby-9.2.5.0
Expand Down
30 changes: 0 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,36 +61,6 @@ hash.fetch(:fooo)
# Did you mean? :foo
```

## Experimental Features

Aside from the basic features above, the `did_you_mean` gem comes with experimental features. They can be enabled by calling `require 'did_you_mean/experimental'`.

Note that **these experimental features should never be enabled in production as they would impact Ruby's performance and use some unstable Ruby APIs.**

### Correcting an Instance Variable When It's Incorrectly Spelled

```ruby
require 'did_you_mean/experimental'

@full_name = "Yuki Nishijima"
@full_anme.split(" ")
# => NoMethodError: undefined method `split' for nil:NilClass
# Did you mean? @full_name
```

### Displaying a Warning When `initialize` is Incorrectly Spelled

```ruby
require 'did_you_mean/experimental'

class Person
def intialize
...
end
end
# => warning: intialize might be misspelled, perhaps you meant initialize?
```

## Verbose Formatter

This verbose formatter changes the error message format to take more lines/spaces so it'll be slightly easier to read the suggestions. This formatter can totally be used in any environment including production.
Expand Down
12 changes: 2 additions & 10 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,19 @@ require 'rake/testtask'
Rake::TestTask.new do |task|
task.libs << "test"

task.test_files = Dir['test/**/test_*.rb'].reject {|path| /(experimental)/ =~ path || path.end_with?("test_explore.rb") }
task.test_files = Dir['test/**/test_*.rb'].reject {|path| path.end_with?("test_explore.rb") }
task.verbose = true
task.warning = true
end

Rake::TestTask.new("test:experimental") do |task|
task.libs << "test"
task.pattern = 'test/experimental/**/test_*.rb'
task.verbose = true
task.warning = true
task.ruby_opts << "-rdid_you_mean/experimental"
end

Rake::TestTask.new("test:explore") do |task|
task.libs << "test"
task.pattern = 'test/tree_spell/test_explore.rb'
task.verbose = true
task.warning = true
end

task default: %i(test test:experimental)
task default: %i(test)

namespace :test do
namespace :accuracy do
Expand Down
4 changes: 2 additions & 2 deletions lib/did_you_mean/experimental.rb
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
require_relative 'experimental/initializer_name_correction'
require_relative 'experimental/ivar_name_correction'
warn "Experimental features in the did_you_mean gem has been removed " \
"and `require \"did_you_mean/experimental\"' has no effect."
51 changes: 0 additions & 51 deletions test/experimental/test_initializer_name_correction.rb

This file was deleted.

13 changes: 0 additions & 13 deletions test/experimental/test_method_name_checker.rb

This file was deleted.

2 changes: 0 additions & 2 deletions test/fixtures/mini_dir.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
---
- test/core_ext/name_error_extension_test.rb
- test/edit_distance/jaro_winkler_test.rb
- test/experimental/initializer_name_correction_test.rb
- test/experimental/method_name_checker_test.rb
- test/fixtures/book.rb
- test/spell_checker_test.rb
- test/spell_checking/class_name_check_test.rb
Expand Down
3 changes: 1 addition & 2 deletions test/tree_spell_checker_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class TreeSpellCheckerTest < Test::Unit::TestCase
RSPEC_DIRECTORIES = YAML.load_file(File.expand_path('fixtures/rspec_dir.yml', __dir__))

def setup
@dictionary =
@dictionary =
%w(
spec/models/concerns/vixen_spec.rb
spec/models/concerns/abcd_spec.rb
Expand Down Expand Up @@ -83,7 +83,6 @@ def special_words_mini
['test/fixtures/book.rb', 'test/fixturWes/book.rb'],
['test/test_helper.rb', 'tes!t/test_helper.rb'],
['test/fixtures/book.rb', 'test/hfixtures/book.rb'],
['test/experimental/method_name_checker_test.rb', 'test/experiental/method_name_checker_test.rb'],
['test/edit_distance/jaro_winkler_test.rb', 'test/eidt_distance/jaro_winkler_test.@rb'],
['test/spell_checker_test.rb', 'test/spell_checke@r_test.rb'],
['test/tree_spell_human_typo_test.rb', 'testt/ree_spell_human_typo_test.rb'],
Expand Down