spellr 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.gitignore +1 -0
- data/.rubocop.yml +3 -3
- data/.travis.yml +5 -2
- data/CHANGELOG.md +5 -0
- data/Gemfile.lock +17 -19
- data/README.md +2 -22
- data/lib/spellr/check.rb +4 -4
- data/lib/spellr/config.rb +18 -1
- data/lib/spellr/interactive.rb +2 -1
- data/lib/spellr/line_tokenizer.rb +1 -1
- data/lib/spellr/version.rb +1 -1
- data/spellr.gemspec +1 -1
- metadata +6 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: '08e49a55e37f2b63ecb10f8ce5218b6c1baa2c53'
|
4
|
+
data.tar.gz: d2d69cdf740d24670efde7b60389494688d42354
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a2d76f91252a4c97fa202f91c8500d0829dbf2392f7d4b433f42dfcc851b4402681e7104f2d19ba47d81ff0d74fd7bf4d0ca487edfe450563c7a38555bf64cb0
|
7
|
+
data.tar.gz: 93b0c4758dd2d39fbe50ff9b8434171955fccef32d973998d4a01be4c4f8b2366160e6f6732709ffee77d533601609e68fb43679ab67457b6ca99d6f7af11b10
|
data/.gitignore
CHANGED
data/.rubocop.yml
CHANGED
@@ -69,15 +69,15 @@ Layout/FirstHashElementLineBreak:
|
|
69
69
|
Enabled: true
|
70
70
|
|
71
71
|
# to match our preference for consistent indentation
|
72
|
-
Layout/
|
72
|
+
Layout/IndentFirstArgument:
|
73
73
|
EnforcedStyle: consistent
|
74
74
|
|
75
75
|
# to match our preference for consistent indentation
|
76
|
-
Layout/
|
76
|
+
Layout/IndentFirstArrayElement:
|
77
77
|
EnforcedStyle: consistent
|
78
78
|
|
79
79
|
# to match our preference for consistent indentation
|
80
|
-
Layout/
|
80
|
+
Layout/IndentFirstHashElement:
|
81
81
|
EnforcedStyle: consistent
|
82
82
|
|
83
83
|
# to match our preference for consistent indentation
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
ADDED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
spellr (0.
|
4
|
+
spellr (0.2.0)
|
5
5
|
fast_ignore
|
6
6
|
parallel
|
7
7
|
|
@@ -11,50 +11,48 @@ GEM
|
|
11
11
|
ast (2.4.0)
|
12
12
|
coderay (1.1.2)
|
13
13
|
diff-lcs (1.3)
|
14
|
-
fast_ignore (0.
|
15
|
-
jaro_winkler (1.5.
|
14
|
+
fast_ignore (0.3.2)
|
15
|
+
jaro_winkler (1.5.3)
|
16
16
|
method_source (0.9.2)
|
17
|
-
parallel (1.
|
18
|
-
parser (2.6.
|
17
|
+
parallel (1.17.0)
|
18
|
+
parser (2.6.4.1)
|
19
19
|
ast (~> 2.4.0)
|
20
20
|
pry (0.12.2)
|
21
21
|
coderay (~> 1.1.0)
|
22
22
|
method_source (~> 0.9.0)
|
23
|
-
psych (3.1.0)
|
24
23
|
rainbow (3.0.0)
|
25
24
|
rake (10.5.0)
|
26
25
|
rspec (3.8.0)
|
27
26
|
rspec-core (~> 3.8.0)
|
28
27
|
rspec-expectations (~> 3.8.0)
|
29
28
|
rspec-mocks (~> 3.8.0)
|
30
|
-
rspec-core (3.8.
|
29
|
+
rspec-core (3.8.2)
|
31
30
|
rspec-support (~> 3.8.0)
|
32
31
|
rspec-eventually (0.2.2)
|
33
|
-
rspec-expectations (3.8.
|
32
|
+
rspec-expectations (3.8.4)
|
34
33
|
diff-lcs (>= 1.2.0, < 2.0)
|
35
34
|
rspec-support (~> 3.8.0)
|
36
|
-
rspec-mocks (3.8.
|
35
|
+
rspec-mocks (3.8.1)
|
37
36
|
diff-lcs (>= 1.2.0, < 2.0)
|
38
37
|
rspec-support (~> 3.8.0)
|
39
|
-
rspec-support (3.8.
|
40
|
-
rubocop (0.
|
38
|
+
rspec-support (3.8.2)
|
39
|
+
rubocop (0.74.0)
|
41
40
|
jaro_winkler (~> 1.5.1)
|
42
41
|
parallel (~> 1.10)
|
43
|
-
parser (>= 2.
|
44
|
-
psych (>= 3.1.0)
|
42
|
+
parser (>= 2.6)
|
45
43
|
rainbow (>= 2.2.2, < 4.0)
|
46
44
|
ruby-progressbar (~> 1.7)
|
47
|
-
unicode-display_width (>= 1.4.0, < 1.
|
48
|
-
rubocop-rspec (1.
|
45
|
+
unicode-display_width (>= 1.4.0, < 1.7)
|
46
|
+
rubocop-rspec (1.35.0)
|
49
47
|
rubocop (>= 0.60.0)
|
50
|
-
ruby-progressbar (1.10.
|
51
|
-
unicode-display_width (1.
|
48
|
+
ruby-progressbar (1.10.1)
|
49
|
+
unicode-display_width (1.6.0)
|
52
50
|
|
53
51
|
PLATFORMS
|
54
52
|
ruby
|
55
53
|
|
56
54
|
DEPENDENCIES
|
57
|
-
bundler (~>
|
55
|
+
bundler (~> 2.0)
|
58
56
|
pry
|
59
57
|
rake (~> 10.0)
|
60
58
|
rspec (~> 3.0)
|
@@ -64,4 +62,4 @@ DEPENDENCIES
|
|
64
62
|
spellr!
|
65
63
|
|
66
64
|
BUNDLED WITH
|
67
|
-
|
65
|
+
2.0.2
|
data/README.md
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# Spellr
|
2
2
|
|
3
|
+
[![Build Status](https://travis-ci.org/robotdana/spellr.svg?branch=master)](https://travis-ci.org/robotdana/spellr)
|
4
|
+
|
3
5
|
Spell check your source code for fun and occasionally finding bugs
|
4
6
|
|
5
7
|
This is inspired by https://github.com/myint/scspell but i wanted a ruby gem
|
@@ -40,25 +42,3 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/robotd
|
|
40
42
|
## License
|
41
43
|
|
42
44
|
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
43
|
-
|
44
|
-
## TODO Before release
|
45
|
-
|
46
|
-
- [x] handle interactive add
|
47
|
-
- [x] handling wordlists per language better
|
48
|
-
- [x] global wordlists
|
49
|
-
- [x] dynamic wordlist (e.g. built from ruby and YOUR Gemfile and stdlib packages)
|
50
|
-
- [x] gem committed semi-dynamic wordlist
|
51
|
-
- [x] gem committed static wordlist
|
52
|
-
- [x] enable/disable
|
53
|
-
- [x] get marketplacer codebase green
|
54
|
-
- [x] escape
|
55
|
-
- [ ] remove default dynamic wordlist nonsense
|
56
|
-
- [x] fix bugs, have specs
|
57
|
-
- [x] attempt key recognition
|
58
|
-
## TODO after release
|
59
|
-
- [ ] throw instead of raise for flow control
|
60
|
-
- [ ] attempt subwords again
|
61
|
-
- [ ] (semi)dynamic js wordlist
|
62
|
-
- [ ] (semi)dynamic html wordlist
|
63
|
-
- [ ] (semi)dynamic bash wordlist
|
64
|
-
- [ ] editor plugins
|
data/lib/spellr/check.rb
CHANGED
@@ -29,9 +29,6 @@ module Spellr
|
|
29
29
|
files.each do |file|
|
30
30
|
check_file(file)
|
31
31
|
checked += 1
|
32
|
-
rescue InvalidByteSequence
|
33
|
-
# sometimes files are binary
|
34
|
-
puts "Skipped unreadable file: #{file}" unless Spellr.config.quiet?
|
35
32
|
end
|
36
33
|
|
37
34
|
reporter.finish(checked) if reporter.respond_to?(:finish)
|
@@ -39,7 +36,7 @@ module Spellr
|
|
39
36
|
|
40
37
|
private
|
41
38
|
|
42
|
-
def check_file(file, start_at: nil, wordlists: Spellr.config.wordlists_for(file))
|
39
|
+
def check_file(file, start_at: nil, wordlists: Spellr.config.wordlists_for(file)) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength, Metrics/LineLength
|
43
40
|
Spellr::Tokenizer.new(file, start_at: start_at).each_token do |token|
|
44
41
|
next if wordlists.any? { |d| d.include?(token) }
|
45
42
|
|
@@ -51,6 +48,9 @@ module Spellr
|
|
51
48
|
check_file(file, start_at: e.token.location, wordlists: wordlists)
|
52
49
|
rescue Spellr::DidAdd => e
|
53
50
|
check_file(file, start_at: e.token.location) # don't cache the wordlists
|
51
|
+
rescue InvalidByteSequence
|
52
|
+
# sometimes files are binary
|
53
|
+
puts "Skipped unreadable file: #{file}" unless Spellr.config.quiet?
|
54
54
|
end
|
55
55
|
end
|
56
56
|
end
|
data/lib/spellr/config.rb
CHANGED
@@ -89,7 +89,24 @@ module Spellr
|
|
89
89
|
|
90
90
|
return {} unless ::File.exist?(path)
|
91
91
|
|
92
|
-
|
92
|
+
if RUBY_VERSION >= '2.5'
|
93
|
+
YAML.safe_load(::File.read(path), symbolize_names: true)
|
94
|
+
else
|
95
|
+
symbolize_names!(YAML.safe_load(::File.read(path)))
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
def symbolize_names!(obj)
|
100
|
+
case obj
|
101
|
+
when Hash
|
102
|
+
obj.keys.each do |key|
|
103
|
+
value = obj.delete(key)
|
104
|
+
obj[key.to_sym] = symbolize_names!(value)
|
105
|
+
end
|
106
|
+
when Array
|
107
|
+
obj.map! { |ea| symbolize_names!(ea) }
|
108
|
+
end
|
109
|
+
obj
|
93
110
|
end
|
94
111
|
|
95
112
|
def merge_config(default, project)
|
data/lib/spellr/interactive.rb
CHANGED
@@ -143,7 +143,8 @@ module Spellr
|
|
143
143
|
def handle_replacement(token, original_token: token) # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
|
144
144
|
readline_editable_print(token.chomp)
|
145
145
|
highlighted_token = token == original_token ? red(token) : token.highlight(original_token.char_range)
|
146
|
-
|
146
|
+
puts "#{aqua '>>'} #{highlighted_token.chomp}"
|
147
|
+
prompt = "#{aqua '=>'} "
|
147
148
|
replacement = Readline.readline(prompt)
|
148
149
|
if replacement.empty?
|
149
150
|
call(token)
|
@@ -115,7 +115,7 @@ module Spellr
|
|
115
115
|
return unless skip_uri?
|
116
116
|
return unless match?(URL_RE)
|
117
117
|
|
118
|
-
captures = URL_RE.match(matched)
|
118
|
+
captures = URL_RE.match(matched)
|
119
119
|
skip(URL_RE) if captures['scheme'] || captures['userinfo'] || captures['path']
|
120
120
|
end
|
121
121
|
|
data/lib/spellr/version.rb
CHANGED
data/spellr.gemspec
CHANGED
@@ -23,7 +23,7 @@ Gem::Specification.new do |spec|
|
|
23
23
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
24
24
|
spec.require_paths = ['lib']
|
25
25
|
|
26
|
-
spec.add_development_dependency 'bundler', '~>
|
26
|
+
spec.add_development_dependency 'bundler', '~> 2.0'
|
27
27
|
spec.add_development_dependency 'pry'
|
28
28
|
spec.add_development_dependency 'rake', '~> 10.0'
|
29
29
|
spec.add_development_dependency 'rspec', '~> 3.0'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spellr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dana Sherson
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-09-
|
11
|
+
date: 2019-09-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '2.0'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '2.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: pry
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -154,6 +154,7 @@ files:
|
|
154
154
|
- ".spellr_wordlists/lorem.txt"
|
155
155
|
- ".spellr_wordlists/ruby.txt"
|
156
156
|
- ".travis.yml"
|
157
|
+
- CHANGELOG.md
|
157
158
|
- Gemfile
|
158
159
|
- Gemfile.lock
|
159
160
|
- LICENSE.txt
|
@@ -210,7 +211,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
210
211
|
version: '0'
|
211
212
|
requirements: []
|
212
213
|
rubyforge_project:
|
213
|
-
rubygems_version: 2.
|
214
|
+
rubygems_version: 2.5.2.1
|
214
215
|
signing_key:
|
215
216
|
specification_version: 4
|
216
217
|
summary: Spell check your source code
|