yard-junk 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Changelog.md +4 -0
- data/lib/yard-junk.rb +1 -0
- data/lib/yard-junk/logger/message.rb +2 -38
- data/lib/yard-junk/logger/spellcheck.rb +52 -0
- data/lib/yard-junk/version.rb +1 -1
- data/yard-junk.gemspec +1 -1
- metadata +3 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4f026c0bf7f4d4490bc4a95d445fafb80d4bfe35
|
4
|
+
data.tar.gz: 26a7538f89dd38d6352575e563b5192b5d15bef0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8cffcf86cc22223300d43cac2609f8aa31c51b65c01c9f9fd9a56a8ddf4cf44e207a51f63543f1e14321c01df538f29288c43948f0356bde1306c7c4d4baa903
|
7
|
+
data.tar.gz: ebde7f6f891bc40cc7f9ebb6be60890b8884a3c4390de1c6a92302a6c759e87ee2b7a695ec61dcc7de9a40bf5bfc57bf186114bd9c270d786420a34a86be0662
|
data/Changelog.md
CHANGED
data/lib/yard-junk.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
3
|
+
require_relative 'spellcheck'
|
4
4
|
|
5
5
|
module YardJunk
|
6
6
|
class Logger
|
@@ -43,43 +43,7 @@ module YardJunk
|
|
43
43
|
self.class.type
|
44
44
|
end
|
45
45
|
|
46
|
-
|
47
|
-
|
48
|
-
# DidYouMean changed API dramatically between 1.0 and 1.1, and different rubies have different
|
49
|
-
# versions of it bundled.
|
50
|
-
if DidYouMean.const_defined?(:SpellCheckable) # 1.0 +
|
51
|
-
class SpellChecker < Struct.new(:error, :dictionary) # rubocop:disable Style/StructInheritance
|
52
|
-
include DidYouMean::SpellCheckable
|
53
|
-
|
54
|
-
def candidates
|
55
|
-
{error => dictionary}
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
def spell_check(error, dictionary)
|
60
|
-
SpellChecker.new(error, dictionary).corrections
|
61
|
-
end
|
62
|
-
elsif DidYouMean.const_defined?(:SpellChecker) # 1.1+
|
63
|
-
def spell_check(error, dictionary)
|
64
|
-
DidYouMean::SpellChecker.new(dictionary: dictionary).correct(error)
|
65
|
-
end
|
66
|
-
elsif DidYouMean.const_defined?(:BaseFinder) # < 1.0
|
67
|
-
class SpellFinder < Struct.new(:error, :dictionary) # rubocop:disable Style/StructInheritance
|
68
|
-
include DidYouMean::BaseFinder
|
69
|
-
|
70
|
-
def searches
|
71
|
-
{error => dictionary}
|
72
|
-
end
|
73
|
-
end
|
74
|
-
|
75
|
-
def spell_check(error, dictionary)
|
76
|
-
SpellFinder.new(error, dictionary).suggestions
|
77
|
-
end
|
78
|
-
else
|
79
|
-
def spell_check(*)
|
80
|
-
[]
|
81
|
-
end
|
82
|
-
end
|
46
|
+
include Spellcheck
|
83
47
|
|
84
48
|
class << self
|
85
49
|
def registry
|
@@ -0,0 +1,52 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
begin
|
4
|
+
require 'did_you_mean'
|
5
|
+
rescue LoadError # rubocop:disable Lint/HandleExceptions
|
6
|
+
end
|
7
|
+
|
8
|
+
module YardJunk
|
9
|
+
class Logger
|
10
|
+
module Spellcheck
|
11
|
+
# DidYouMean changed API dramatically between 1.0 and 1.1, and different rubies have different
|
12
|
+
# versions of it bundled.
|
13
|
+
if !Kernel.const_defined?(:DidYouMean)
|
14
|
+
def spell_check(*)
|
15
|
+
[]
|
16
|
+
end
|
17
|
+
elsif DidYouMean.const_defined?(:SpellCheckable) # 1.0 +
|
18
|
+
class SpellChecker < Struct.new(:error, :dictionary) # rubocop:disable Style/StructInheritance
|
19
|
+
include DidYouMean::SpellCheckable
|
20
|
+
|
21
|
+
def candidates
|
22
|
+
{error => dictionary}
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def spell_check(error, dictionary)
|
27
|
+
SpellChecker.new(error, dictionary).corrections
|
28
|
+
end
|
29
|
+
elsif DidYouMean.const_defined?(:SpellChecker) # 1.1+
|
30
|
+
def spell_check(error, dictionary)
|
31
|
+
DidYouMean::SpellChecker.new(dictionary: dictionary).correct(error)
|
32
|
+
end
|
33
|
+
elsif DidYouMean.const_defined?(:BaseFinder) # < 1.0
|
34
|
+
class SpellFinder < Struct.new(:error, :dictionary) # rubocop:disable Style/StructInheritance
|
35
|
+
include DidYouMean::BaseFinder
|
36
|
+
|
37
|
+
def searches
|
38
|
+
{error => dictionary}
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def spell_check(error, dictionary)
|
43
|
+
SpellFinder.new(error, dictionary).suggestions
|
44
|
+
end
|
45
|
+
else
|
46
|
+
def spell_check(*)
|
47
|
+
[]
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
data/lib/yard-junk/version.rb
CHANGED
data/yard-junk.gemspec
CHANGED
@@ -35,7 +35,7 @@ Gem::Specification.new do |s|
|
|
35
35
|
|
36
36
|
s.add_dependency 'rainbow'
|
37
37
|
s.add_dependency 'yard'
|
38
|
-
s.add_dependency 'did_you_mean'
|
38
|
+
s.add_dependency 'did_you_mean' if RUBY_VERSION < '2.3'
|
39
39
|
s.add_dependency 'backports'
|
40
40
|
|
41
41
|
s.add_development_dependency 'rubocop', '>= 0.49'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yard-junk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Victor Shepelev
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-09-
|
11
|
+
date: 2017-09-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rainbow
|
@@ -38,20 +38,6 @@ dependencies:
|
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: did_you_mean
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - ">="
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '0'
|
48
|
-
type: :runtime
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - ">="
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '0'
|
55
41
|
- !ruby/object:Gem::Dependency
|
56
42
|
name: backports
|
57
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -217,6 +203,7 @@ files:
|
|
217
203
|
- lib/yard-junk/janitor/text_reporter.rb
|
218
204
|
- lib/yard-junk/logger.rb
|
219
205
|
- lib/yard-junk/logger/message.rb
|
206
|
+
- lib/yard-junk/logger/spellcheck.rb
|
220
207
|
- lib/yard-junk/rake.rb
|
221
208
|
- lib/yard-junk/version.rb
|
222
209
|
- yard-junk.gemspec
|