yard-spellcheck 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/ChangeLog.md +5 -0
- data/gemspec.yml +1 -1
- data/lib/yard/spellcheck/checker.rb +19 -11
- metadata +6 -31
data/ChangeLog.md
CHANGED
data/gemspec.yml
CHANGED
@@ -41,10 +41,10 @@ module YARD
|
|
41
41
|
# @option options [String, Symbol] :lang (FFI::Hunspell.lang)
|
42
42
|
# The language to spellcheck against.
|
43
43
|
#
|
44
|
-
# @option options [Array
|
44
|
+
# @option options [Array<String>, Set<String>] :ignore
|
45
45
|
# The words to ignore.
|
46
46
|
#
|
47
|
-
# @option options [Array
|
47
|
+
# @option options [Array<String>] :add
|
48
48
|
# The words to add to the dictionary.
|
49
49
|
#
|
50
50
|
def initialize(options={})
|
@@ -92,7 +92,7 @@ module YARD
|
|
92
92
|
|
93
93
|
FFI::Hunspell.dict(@lang) do |dict|
|
94
94
|
# add user specified words
|
95
|
-
@added.each { |word| dict.add(word) }
|
95
|
+
@added.each { |word| dict.add(word.dup) }
|
96
96
|
|
97
97
|
unless names.empty?
|
98
98
|
names.each do |name|
|
@@ -161,17 +161,25 @@ module YARD
|
|
161
161
|
def spellcheck(text,dict)
|
162
162
|
typos = Set[]
|
163
163
|
|
164
|
-
text.
|
165
|
-
# ignore
|
166
|
-
next if
|
164
|
+
text.each_line do |line|
|
165
|
+
# ignore indented lines
|
166
|
+
next if line =~ /^\s{2,}/
|
167
167
|
|
168
|
-
|
169
|
-
|
168
|
+
line.scan(WORD_REGEXP).each do |word|
|
169
|
+
# ignore all underscored names
|
170
|
+
next if word.include?('_')
|
170
171
|
|
171
|
-
|
172
|
-
|
172
|
+
# ignore all acronyms and CamelCase words
|
173
|
+
next if (word =~ ACRONYM_REGEXP || word =~ CAMEL_CASE_REGEXP)
|
173
174
|
|
174
|
-
|
175
|
+
# skip ignored words
|
176
|
+
next if @ignore.include?(word)
|
177
|
+
|
178
|
+
if (@misspelled.has_key?(word) || !dict.valid?(word))
|
179
|
+
@misspelled[word] += 1
|
180
|
+
|
181
|
+
typos << word
|
182
|
+
end
|
175
183
|
end
|
176
184
|
end
|
177
185
|
|
metadata
CHANGED
@@ -1,12 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yard-spellcheck
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
prerelease:
|
5
|
-
|
6
|
-
- 0
|
7
|
-
- 1
|
8
|
-
- 1
|
9
|
-
version: 0.1.1
|
4
|
+
prerelease:
|
5
|
+
version: 0.1.2
|
10
6
|
platform: ruby
|
11
7
|
authors:
|
12
8
|
- Postmodern
|
@@ -14,8 +10,7 @@ autorequire:
|
|
14
10
|
bindir: bin
|
15
11
|
cert_chain: []
|
16
12
|
|
17
|
-
date: 2011-
|
18
|
-
default_executable: yard-spellcheck
|
13
|
+
date: 2011-05-17 00:00:00 Z
|
19
14
|
dependencies:
|
20
15
|
- !ruby/object:Gem::Dependency
|
21
16
|
name: yard
|
@@ -25,10 +20,6 @@ dependencies:
|
|
25
20
|
requirements:
|
26
21
|
- - ~>
|
27
22
|
- !ruby/object:Gem::Version
|
28
|
-
segments:
|
29
|
-
- 0
|
30
|
-
- 6
|
31
|
-
- 0
|
32
23
|
version: 0.6.0
|
33
24
|
type: :runtime
|
34
25
|
version_requirements: *id001
|
@@ -40,10 +31,6 @@ dependencies:
|
|
40
31
|
requirements:
|
41
32
|
- - ~>
|
42
33
|
- !ruby/object:Gem::Version
|
43
|
-
segments:
|
44
|
-
- 0
|
45
|
-
- 2
|
46
|
-
- 0
|
47
34
|
version: 0.2.0
|
48
35
|
type: :runtime
|
49
36
|
version_requirements: *id002
|
@@ -55,10 +42,6 @@ dependencies:
|
|
55
42
|
requirements:
|
56
43
|
- - ~>
|
57
44
|
- !ruby/object:Gem::Version
|
58
|
-
segments:
|
59
|
-
- 0
|
60
|
-
- 3
|
61
|
-
- 0
|
62
45
|
version: 0.3.0
|
63
46
|
type: :development
|
64
47
|
version_requirements: *id003
|
@@ -70,15 +53,12 @@ dependencies:
|
|
70
53
|
requirements:
|
71
54
|
- - ~>
|
72
55
|
- !ruby/object:Gem::Version
|
73
|
-
segments:
|
74
|
-
- 2
|
75
|
-
- 4
|
76
|
-
- 0
|
77
56
|
version: 2.4.0
|
78
57
|
type: :development
|
79
58
|
version_requirements: *id004
|
80
59
|
description: Adds the 'spellcheck' command to YARD, which will spellcheck every docstring within your documentation.
|
81
|
-
email:
|
60
|
+
email:
|
61
|
+
- postmodern.mod3@gmail.com
|
82
62
|
executables:
|
83
63
|
- yard-spellcheck
|
84
64
|
extensions: []
|
@@ -103,7 +83,6 @@ files:
|
|
103
83
|
- lib/yard/spellcheck/printer.rb
|
104
84
|
- spec/spec_helper.rb
|
105
85
|
- yard-spellcheck.gemspec
|
106
|
-
has_rdoc: yard
|
107
86
|
homepage: http://github.com/postmodern/yard-spellcheck
|
108
87
|
licenses:
|
109
88
|
- MIT
|
@@ -117,21 +96,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
117
96
|
requirements:
|
118
97
|
- - ">="
|
119
98
|
- !ruby/object:Gem::Version
|
120
|
-
segments:
|
121
|
-
- 0
|
122
99
|
version: "0"
|
123
100
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
124
101
|
none: false
|
125
102
|
requirements:
|
126
103
|
- - ">="
|
127
104
|
- !ruby/object:Gem::Version
|
128
|
-
segments:
|
129
|
-
- 0
|
130
105
|
version: "0"
|
131
106
|
requirements: []
|
132
107
|
|
133
108
|
rubyforge_project: yard-spellcheck
|
134
|
-
rubygems_version: 1.
|
109
|
+
rubygems_version: 1.8.1
|
135
110
|
signing_key:
|
136
111
|
specification_version: 3
|
137
112
|
summary: Spellcheck your YARD documentat
|