aspelllint 0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 3aa5c1515f5f237357db96db2851882f30217bfc
4
+ data.tar.gz: 6e1153b4b11dc8a12ae85fa492460105899fd377
5
+ SHA512:
6
+ metadata.gz: 4c679d0d9accb0590cf5dc54b031e4fe46b07cb52ba327259f1cee20057d56842d304521d2508c19974ec2d23fe872cc751b39bdccf796f01c09d325c1bed3a3
7
+ data.tar.gz: 80855b3c522bbb4d0eb4b91163f9a1d67871545c8bf0783468cc38fbd194497ea438ad021e22123e3b929a68098499a39bf472a0b70f4ad5fd3da1a1e0ea9de9
@@ -0,0 +1,23 @@
1
+ # FreeBSD License
2
+
3
+ # Copyright 2014 Andrew Pennebaker. All rights reserved.
4
+
5
+ Redistribution and use in source and binary forms, with or without modification,
6
+ are permitted provided that the following conditions are met:
7
+
8
+ 1. Redistributions of source code must retain the above copyright notice, this
9
+ list of conditions and the following disclaimer.
10
+ 2. Redistributions in binary form must reproduce the above copyright notice,
11
+ this list of conditions and the following disclaimer in the documentation and/or
12
+ other materials provided with the distribution.
13
+
14
+ THIS SOFTWARE IS PROVIDED BY THE AUTHORS "AS IS" AND ANY EXPRESS OR IMPLIED
15
+ WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
16
+ MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
17
+ SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
18
+ INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
19
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
21
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
22
+ OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
23
+ ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,53 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'find'
4
+ require 'optparse'
5
+
6
+ require 'rubygems'
7
+ require 'aspelllint'
8
+
9
+ def main
10
+ ignores = DEFAULT_IGNORES
11
+
12
+ filenames = ['.']
13
+
14
+ option = OptionParser.new do |option|
15
+ option.banner = 'Usage: aspelllint [options] [<files>]'
16
+
17
+ option.on('-i', '--ignore pattern', 'Ignore file names matching Ruby regex pattern') do |pattern|
18
+ ignores << pattern
19
+ end
20
+
21
+ option.on('-h', '--help', 'Print usage info') do
22
+ puts option
23
+ exit
24
+ end
25
+
26
+ option.on('-v', '--version', 'Print version info') do
27
+ puts "aspelllint #{Aspelllint::VERSION}"
28
+ exit
29
+ end
30
+ end
31
+
32
+ option.parse!
33
+
34
+ filenames = ARGV unless ARGV.empty?
35
+
36
+ recursive_files = []
37
+
38
+ filenames.each do |f|
39
+ if File.directory? f
40
+ recursive_files = recursive_files.concat(recursive_list(f, ignores))
41
+ else
42
+ recursive_files << f
43
+ end
44
+ end
45
+
46
+ recursive_files.each { |f| check f }
47
+ end
48
+
49
+ begin
50
+ main
51
+ rescue Interrupt
52
+ nil
53
+ end
@@ -0,0 +1,58 @@
1
+ require 'rubygems'
2
+ require 'ptools'
3
+
4
+ require 'version'
5
+
6
+ DEFAULT_IGNORES = %w(
7
+ .git/
8
+ .hg/
9
+ .svn/
10
+ )
11
+
12
+ #
13
+ # Parse, model, and print a misspelling
14
+ #
15
+ class Misspelling
16
+ attr_accessor :filename, :line, :column, :word, :suggestions
17
+
18
+ def self.parse(filename, aspell_line)
19
+ match = aspell_line.match(/^\&\s(.+)\s([0-9]+)\s([0-9]+)\:\s(.+)$/)
20
+
21
+ w = match[1]
22
+ l = match[2]
23
+ c = match[3]
24
+ s = match[4]
25
+
26
+ Misspelling.new(filename, w, l, c, s)
27
+ end
28
+
29
+ def initialize(filename, word, line, column, suggestions)
30
+ @filename = filename
31
+ @word = word
32
+ @line = line
33
+ @column = column
34
+ @suggestions = suggestions
35
+ end
36
+
37
+ def to_s
38
+ "#{filename}:#{line}:#{column} #{word}: #{suggestions}"
39
+ end
40
+ end
41
+
42
+ def self.recursive_list(directory, ignores = DEFAULT_IGNORES)
43
+ Find.find(directory).reject do |f|
44
+ File.directory?(f) ||
45
+ ignores.any? { |ignore| f =~ /#{ignore}/ } ||
46
+ File.binary?(f)
47
+ end
48
+ end
49
+
50
+ def check(filename)
51
+ output = `sed 's/#/ /g' < #{filename} | aspell -a -c 2>&1`
52
+
53
+ lines = output.split("\n").select { |line| line =~ /^\&\s.+$/ }
54
+
55
+ misspellings = lines.map { |line| Misspelling.parse(filename, line) }
56
+
57
+ misspellings.each { |m| puts m }
58
+ end
@@ -0,0 +1,6 @@
1
+ #
2
+ # Aspelllint
3
+ #
4
+ module Aspelllint
5
+ VERSION = '0.1'
6
+ end
metadata ADDED
@@ -0,0 +1,259 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: aspelllint
3
+ version: !ruby/object:Gem::Version
4
+ version: '0.1'
5
+ platform: ruby
6
+ authors:
7
+ - Andrew Pennebaker
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-03-05 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: ptools
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '>='
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: reek
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: flay
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: flog
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - '>='
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: roodi
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - '>='
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - '>='
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: churn
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - '>='
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - '>='
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: cane
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - '>='
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - '>='
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: excellent
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - '>='
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - '>='
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
139
+ - !ruby/object:Gem::Dependency
140
+ name: rubocop
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - '>='
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - '>='
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
153
+ - !ruby/object:Gem::Dependency
154
+ name: tailor
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - '>='
158
+ - !ruby/object:Gem::Version
159
+ version: '0'
160
+ type: :development
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - '>='
165
+ - !ruby/object:Gem::Version
166
+ version: '0'
167
+ - !ruby/object:Gem::Dependency
168
+ name: guard
169
+ requirement: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - '>='
172
+ - !ruby/object:Gem::Version
173
+ version: '0'
174
+ type: :development
175
+ prerelease: false
176
+ version_requirements: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - '>='
179
+ - !ruby/object:Gem::Version
180
+ version: '0'
181
+ - !ruby/object:Gem::Dependency
182
+ name: guard-shell
183
+ requirement: !ruby/object:Gem::Requirement
184
+ requirements:
185
+ - - '>='
186
+ - !ruby/object:Gem::Version
187
+ version: '0.6'
188
+ type: :development
189
+ prerelease: false
190
+ version_requirements: !ruby/object:Gem::Requirement
191
+ requirements:
192
+ - - '>='
193
+ - !ruby/object:Gem::Version
194
+ version: '0.6'
195
+ - !ruby/object:Gem::Dependency
196
+ name: rspec
197
+ requirement: !ruby/object:Gem::Requirement
198
+ requirements:
199
+ - - '>='
200
+ - !ruby/object:Gem::Version
201
+ version: '0'
202
+ type: :development
203
+ prerelease: false
204
+ version_requirements: !ruby/object:Gem::Requirement
205
+ requirements:
206
+ - - '>='
207
+ - !ruby/object:Gem::Version
208
+ version: '0'
209
+ - !ruby/object:Gem::Dependency
210
+ name: cucumber
211
+ requirement: !ruby/object:Gem::Requirement
212
+ requirements:
213
+ - - '>='
214
+ - !ruby/object:Gem::Version
215
+ version: '0'
216
+ type: :development
217
+ prerelease: false
218
+ version_requirements: !ruby/object:Gem::Requirement
219
+ requirements:
220
+ - - '>='
221
+ - !ruby/object:Gem::Version
222
+ version: '0'
223
+ description: See README.md for example usage
224
+ email: andrew.pennebaker@gmail.com
225
+ executables:
226
+ - aspelllint
227
+ extensions: []
228
+ extra_rdoc_files: []
229
+ files:
230
+ - lib/aspelllint.rb
231
+ - lib/version.rb
232
+ - LICENSE.md
233
+ - bin/aspelllint
234
+ homepage: https://github.com/mcandre/aspelllint
235
+ licenses:
236
+ - FreeBSD
237
+ metadata: {}
238
+ post_install_message:
239
+ rdoc_options: []
240
+ require_paths:
241
+ - lib
242
+ required_ruby_version: !ruby/object:Gem::Requirement
243
+ requirements:
244
+ - - '>='
245
+ - !ruby/object:Gem::Version
246
+ version: '0'
247
+ required_rubygems_version: !ruby/object:Gem::Requirement
248
+ requirements:
249
+ - - '>='
250
+ - !ruby/object:Gem::Version
251
+ version: '0'
252
+ requirements: []
253
+ rubyforge_project:
254
+ rubygems_version: 2.1.10
255
+ signing_key:
256
+ specification_version: 4
257
+ summary: spell check for large projects
258
+ test_files: []
259
+ has_rdoc: