spellr 0.8.8 → 0.9.0
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/README.md +1 -1
- data/lib/spellr/config_loader.rb +1 -1
- data/lib/spellr/file.rb +1 -1
- data/lib/spellr/stringio_with_encoding.rb +11 -0
- data/lib/spellr/token_regexps.rb +3 -2
- data/lib/spellr/tokenizer.rb +8 -6
- data/lib/spellr/version.rb +1 -1
- data/lib/spellr/wordlist.rb +3 -3
- data/spellr.gemspec +1 -1
- metadata +10 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 60659d04d7461c60fc7880fe44fa4af1d6b852511affaef3722d8bca7902bebe
|
4
|
+
data.tar.gz: 6327cb52ae02517918e886b774311f09270dc1e96166361962c49f9f01f28506
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1aadb5c07c9ce3fa8899be299810480034d1bfed1e93aa9fe0e07192edb9cac21e8c505908da7757badb0190da5d0251c47cf135306aa60cde8abbee2a4e3db8
|
7
|
+
data.tar.gz: 7fc321f6665f93c4093a46748781eb59ce56930c334298670e5592d63887e97092bc2ab49394ab08f143d8a84a213e4df76a149b6f97065b51f78feebc56e91c
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
data/lib/spellr/config_loader.rb
CHANGED
@@ -32,7 +32,7 @@ module Spellr
|
|
32
32
|
def load_yaml(path)
|
33
33
|
return {} unless ::File.exist?(path)
|
34
34
|
|
35
|
-
YAML.safe_load(::File.read(path), symbolize_names: true)
|
35
|
+
YAML.safe_load(::File.read(path, encoding: ::Encoding::UTF_8), symbolize_names: true)
|
36
36
|
end
|
37
37
|
|
38
38
|
def merge_config(default, project) # rubocop:disable Metrics/MethodLength
|
data/lib/spellr/file.rb
CHANGED
@@ -0,0 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Spellr
|
4
|
+
class StringIOWithEncoding < ::StringIO
|
5
|
+
def each_line(*args, encoding: nil, **kwargs, &block)
|
6
|
+
string.force_encoding(encoding) if encoding && !string.frozen?
|
7
|
+
|
8
|
+
super(*args, **kwargs, &block)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
data/lib/spellr/token_regexps.rb
CHANGED
@@ -39,8 +39,9 @@ module Spellr
|
|
39
39
|
# literal \ so that i can match on domains in regexps. no-one cares but me.
|
40
40
|
URL_HOSTNAME = /(?:[[:alnum:]\-\\]+(?:\.[[:alnum:]\-\\]+)+|localhost|#{URL_IP_ADDRESS})/.freeze
|
41
41
|
URL_PORT = /:\d+/.freeze
|
42
|
-
URL_PATH = %r{/(?:[[:alnum:]=@!$&~\-/._\\]|%\h{2})
|
43
|
-
|
42
|
+
URL_PATH = %r{/(?:[[:alnum:]=@!$&~\-/._\\]|%\h{2})*}.freeze
|
43
|
+
URL_QUERY_PART = %r{(?:[[:alnum:]=!$\-/._\\]|%\h{2})+}.freeze
|
44
|
+
URL_QUERY = /\?#{URL_QUERY_PART}(?:&#{URL_QUERY_PART})*/.freeze
|
44
45
|
URL_FRAGMENT = %r{#(?:[[:alnum:]=!$&\-/.\\]|%\h{2})+}.freeze
|
45
46
|
|
46
47
|
# URL can be any valid hostname, it must have either a scheme, userinfo, or path
|
data/lib/spellr/tokenizer.rb
CHANGED
@@ -27,7 +27,7 @@ module Spellr
|
|
27
27
|
end
|
28
28
|
|
29
29
|
def each_term(&block)
|
30
|
-
file.each_line do |line|
|
30
|
+
file.each_line(encoding: ::Encoding::UTF_8) do |line|
|
31
31
|
prepare_tokenizer_for_line(line)&.each_term(&block)
|
32
32
|
end
|
33
33
|
ensure
|
@@ -56,12 +56,14 @@ module Spellr
|
|
56
56
|
char_offset = @start_at.line_location.char_offset
|
57
57
|
byte_offset = @start_at.line_location.byte_offset
|
58
58
|
|
59
|
-
file
|
60
|
-
|
59
|
+
file
|
60
|
+
.each_line(encoding: ::Encoding::UTF_8)
|
61
|
+
.with_index(@start_at.line_location.line_number) do |line, line_number|
|
62
|
+
yield line, line_number, char_offset, byte_offset
|
61
63
|
|
62
|
-
|
63
|
-
|
64
|
-
|
64
|
+
char_offset += line.length
|
65
|
+
byte_offset += line.bytesize
|
66
|
+
end
|
65
67
|
ensure
|
66
68
|
file.close
|
67
69
|
end
|
data/lib/spellr/version.rb
CHANGED
data/lib/spellr/wordlist.rb
CHANGED
@@ -41,7 +41,7 @@ module Spellr
|
|
41
41
|
touch
|
42
42
|
@include[term] = true
|
43
43
|
insert_sorted(term)
|
44
|
-
@path.write(words.join) # we don't need to clear the cache
|
44
|
+
@path.write(words.join, encoding: ::Encoding::UTF_8) # we don't need to clear the cache
|
45
45
|
end
|
46
46
|
|
47
47
|
def words
|
@@ -55,7 +55,7 @@ module Spellr
|
|
55
55
|
end
|
56
56
|
|
57
57
|
def write(content)
|
58
|
-
@path.write(content)
|
58
|
+
@path.write(content, encoding: ::Encoding::UTF_8)
|
59
59
|
|
60
60
|
clear_cache
|
61
61
|
end
|
@@ -70,7 +70,7 @@ module Spellr
|
|
70
70
|
return if exist?
|
71
71
|
|
72
72
|
@path.dirname.mkpath
|
73
|
-
@path.write('')
|
73
|
+
@path.write('', encoding: ::Encoding::UTF_8)
|
74
74
|
clear_cache
|
75
75
|
end
|
76
76
|
|
data/spellr.gemspec
CHANGED
@@ -44,7 +44,7 @@ Gem::Specification.new do |spec|
|
|
44
44
|
spec.add_development_dependency 'rubocop-rspec', '~> 1.44.1'
|
45
45
|
spec.add_development_dependency 'simplecov', '~> 0.18.5'
|
46
46
|
spec.add_development_dependency 'simplecov-console'
|
47
|
-
spec.add_development_dependency 'tty_string', '>=
|
47
|
+
spec.add_development_dependency 'tty_string', '>= 1.1.0'
|
48
48
|
spec.add_development_dependency 'webmock', '~> 3.8'
|
49
49
|
|
50
50
|
spec.add_dependency 'fast_ignore', '>= 0.11.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.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dana Sherson
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-06-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -170,14 +170,14 @@ dependencies:
|
|
170
170
|
requirements:
|
171
171
|
- - ">="
|
172
172
|
- !ruby/object:Gem::Version
|
173
|
-
version:
|
173
|
+
version: 1.1.0
|
174
174
|
type: :development
|
175
175
|
prerelease: false
|
176
176
|
version_requirements: !ruby/object:Gem::Requirement
|
177
177
|
requirements:
|
178
178
|
- - ">="
|
179
179
|
- !ruby/object:Gem::Version
|
180
|
-
version:
|
180
|
+
version: 1.1.0
|
181
181
|
- !ruby/object:Gem::Dependency
|
182
182
|
name: webmock
|
183
183
|
requirement: !ruby/object:Gem::Requirement
|
@@ -220,7 +220,7 @@ dependencies:
|
|
220
220
|
- - "~>"
|
221
221
|
- !ruby/object:Gem::Version
|
222
222
|
version: '1.0'
|
223
|
-
description:
|
223
|
+
description:
|
224
224
|
email:
|
225
225
|
- robot@dana.sh
|
226
226
|
executables:
|
@@ -266,6 +266,7 @@ files:
|
|
266
266
|
- lib/spellr/rake_task.rb
|
267
267
|
- lib/spellr/reporter.rb
|
268
268
|
- lib/spellr/string_format.rb
|
269
|
+
- lib/spellr/stringio_with_encoding.rb
|
269
270
|
- lib/spellr/token.rb
|
270
271
|
- lib/spellr/token_regexps.rb
|
271
272
|
- lib/spellr/tokenizer.rb
|
@@ -303,7 +304,7 @@ metadata:
|
|
303
304
|
homepage_uri: http://github.com/robotdana/spellr
|
304
305
|
source_code_uri: http://github.com/robotdana/spellr
|
305
306
|
changelog_uri: http://github.com/robotdana/spellr/blob/main/CHANGELOG.md
|
306
|
-
post_install_message:
|
307
|
+
post_install_message:
|
307
308
|
rdoc_options: []
|
308
309
|
require_paths:
|
309
310
|
- lib
|
@@ -318,8 +319,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
318
319
|
- !ruby/object:Gem::Version
|
319
320
|
version: '0'
|
320
321
|
requirements: []
|
321
|
-
rubygems_version: 3.
|
322
|
-
signing_key:
|
322
|
+
rubygems_version: 3.2.15
|
323
|
+
signing_key:
|
323
324
|
specification_version: 4
|
324
325
|
summary: Spell check your source code
|
325
326
|
test_files: []
|