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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e09ecd923199d9533b1aa92210b6c4f8b02c03f3c4f420a46fd1519248556bff
4
- data.tar.gz: ad58ff25a6c0e96598da4dc0bf86f6f380132be18866ff3c861237190aea4e71
3
+ metadata.gz: 60659d04d7461c60fc7880fe44fa4af1d6b852511affaef3722d8bca7902bebe
4
+ data.tar.gz: 6327cb52ae02517918e886b774311f09270dc1e96166361962c49f9f01f28506
5
5
  SHA512:
6
- metadata.gz: a47ec69ccdb59b1de84f509ec25457331b8b9306bb566e7f34a13872d36bd7a7d288e61eb73e96674da2fc1730f7cc41f250f8894457a97f02d656fbd3bfb9ca
7
- data.tar.gz: a792a72098ec9601a06c2eacb279db00fc87a3b6e232d5466a896070420103115ae63f0699ce1de79a185839270c8b6b3d6bc0ca2b2ca100394079da4a6721ba
6
+ metadata.gz: 1aadb5c07c9ce3fa8899be299810480034d1bfed1e93aa9fe0e07192edb9cac21e8c505908da7757badb0190da5d0251c47cf135306aa60cde8abbee2a4e3db8
7
+ data.tar.gz: 7fc321f6665f93c4093a46748781eb59ce56930c334298670e5592d63887e97092bc2ab49394ab08f143d8a84a213e4df76a149b6f97065b51f78feebc56e91c
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ # v0.9.0
2
+ - Recognize url with _ in query string and zero length path
3
+ - Assume all files are utf8
4
+
1
5
  # v0.8.8
2
6
  - output a suggested `spellr --interactive` command with filenames, when running this without --interactive
3
7
 
data/README.md CHANGED
@@ -27,7 +27,7 @@ However, in a programming context spelling things _consistently_ is useful, wher
27
27
 
28
28
  ## Installation
29
29
 
30
- This is tested against ruby 2.4.0-3.0.0.preview1.
30
+ This is tested against ruby 2.4-3.0.
31
31
 
32
32
  ### With Bundler
33
33
 
@@ -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
@@ -34,7 +34,7 @@ module Spellr
34
34
  end
35
35
 
36
36
  def read_write
37
- write(yield read)
37
+ write(yield(read(encoding: ::Encoding::UTF_8)), encoding: ::Encoding::UTF_8)
38
38
  end
39
39
  end
40
40
  end
@@ -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
@@ -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})+}.freeze
43
- URL_QUERY = %r{\?(?:[[:alnum:]=!$\-/.\\]|%\h{2})+(?:&(?:[[:alnum:]=!$\-/.\\]|%\h{2})+)*}.freeze
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
@@ -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.each_line.with_index(@start_at.line_location.line_number) do |line, line_number|
60
- yield line, line_number, char_offset, byte_offset
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
- char_offset += line.length
63
- byte_offset += line.bytesize
64
- end
64
+ char_offset += line.length
65
+ byte_offset += line.bytesize
66
+ end
65
67
  ensure
66
68
  file.close
67
69
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Spellr
4
- VERSION = '0.8.8'
4
+ VERSION = '0.9.0'
5
5
  end
@@ -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', '>= 0.2.1'
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.8.8
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: 2020-12-18 00:00:00.000000000 Z
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: 0.2.1
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: 0.2.1
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.1.2
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: []