spellr 0.8.4 → 0.8.5

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: 52262546809e049a6c04f71c067d895e2cd83b865bc1371a4c9c489ca8b8b5b7
4
- data.tar.gz: c75f1e3037419fb9e917cac1d808fa3f32a882f0c76bb2a871ddca8ac8b33ea3
3
+ metadata.gz: 80438eca6b5b281ceab331e0ab9886fcb9c622cfe1e91ca2762ed10628c44ee1
4
+ data.tar.gz: 434910ca88653cb6a7d4bb11dabc32e4c782b22df4e65cc488ebaf6439bb3b38
5
5
  SHA512:
6
- metadata.gz: 12771b2588b7b8e2bfdfadec6c78cf4dd5f90000730451f8f8f7f066de77aba171a6227fa9c3a0ea914fb3dd7f33cd975b9dcfb2d73d0fb11a03898e460ed489
7
- data.tar.gz: bfa05561e73da2b21fe6d2e7a138c8dfae8eda29dcadb83dd5c10e31b5d7b525b18161f8f9cd944b1d58ae1b46022ca2a4e4d05c7efad68d3363540714ca6b16
6
+ metadata.gz: b14f3fe397b01f9a7e1742246a451e68238833c98e98b6716e36a11bb38d556463d992a0cdb8577f2dac2b65bb39eb0a9f3d050f884814c7449d0b6d2239e013
7
+ data.tar.gz: 45fe01c33fd31faafd21248751f2a85f38c3807b75eb242fa994ffbdd14735f2dde343cf397b5f14281a24107ca5532d45b4c107b720546ac4994121c5599e58
@@ -1,3 +1,6 @@
1
+ # v0.8.5
2
+ - Single line disable! use `spellr:disable-line` #25
3
+
1
4
  # v0.8.4
2
5
  - Update fast_ignore dependency, it's faster now (about 0.5s faster on rails codebase)
3
6
 
data/README.md CHANGED
@@ -175,14 +175,21 @@ Type `e` to add this word to the english wordlist and continue on through the sp
175
175
 
176
176
  ### Disabling the tokenizer
177
177
 
178
- If the tokenizer finds a word you don't want to add to the wordlist (perhaps it's an intentional example of a typo, or a non-word string not excluded by the heuristic) then place on the lines before and after
178
+ If the tokenizer finds a word you don't want to add to the wordlist (perhaps it's an intentional example of a typo, or a non-word string not excluded by the heuristic) then add any kind of comment containing `spellr:disable-line` to the line.
179
+ ```ruby
180
+ open('mispeled_filename.txt') # spellr:disable-line
181
+ ```
182
+
183
+ You can also disable multiple lines, by surrounding the offending code with `spellr:disable` and `spellr:enable`
179
184
  ```ruby
180
185
  # spellr:disable
181
- "Test typo of the: teh"
186
+ it "Test typo of the: teh" do
187
+ fill_in(field, with: "teh")
188
+ end
182
189
  # spellr:enable
183
190
  ```
184
191
 
185
- This works with any kind of comment, even in the same line
192
+ If your language supports inline comments you can also surround with `spellr:disable` and `spellr:enable` in the same line:
186
193
  ```html
187
194
  <span><!-- spellr:disable -->nonsenseword<!-- spellr:enable --></span>
188
195
  ```
@@ -7,6 +7,7 @@ require_relative 'string_format'
7
7
  module Spellr
8
8
  class Check
9
9
  attr_reader :files, :reporter
10
+
10
11
  include StringFormat
11
12
 
12
13
  def exit_code
@@ -98,5 +98,6 @@ module Spellr
98
98
 
99
99
  SPELLR_DISABLE_RE = /spellr:disable/.freeze
100
100
  SPELLR_ENABLE_RE = /spellr:enable/.freeze
101
+ SPELLR_LINE_DISABLE_RE = /spellr:disable[-:]line/.freeze
101
102
  end
102
103
  end
@@ -28,7 +28,7 @@ module Spellr
28
28
 
29
29
  def each_term(&block)
30
30
  file.each_line do |line|
31
- prepare_tokenizer_for_line(line).each_term(&block)
31
+ prepare_tokenizer_for_line(line)&.each_term(&block)
32
32
  end
33
33
  ensure
34
34
  file.close
@@ -36,7 +36,7 @@ module Spellr
36
36
 
37
37
  def each_token(skip_term_proc: nil) # rubocop:disable Metrics/MethodLength
38
38
  each_line_with_stats do |line, line_number, char_offset, byte_offset|
39
- prepare_tokenizer_for_line(line).each_token(skip_term_proc: skip_term_proc) do |token|
39
+ prepare_tokenizer_for_line(line)&.each_token(skip_term_proc: skip_term_proc) do |token|
40
40
  token.line = prepare_line(line, line_number, char_offset, byte_offset)
41
41
 
42
42
  yield token
@@ -75,6 +75,8 @@ module Spellr
75
75
  attr_reader :line_tokenizer
76
76
 
77
77
  def prepare_tokenizer_for_line(line)
78
+ return if line.match?(Spellr::TokenRegexps::SPELLR_LINE_DISABLE_RE)
79
+
78
80
  line_tokenizer.string = line
79
81
  line_tokenizer.pos = 0
80
82
  line_tokenizer
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Spellr
4
- VERSION = '0.8.4'
4
+ VERSION = '0.8.5'
5
5
  end
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.4
4
+ version: 0.8.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dana Sherson
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-05-02 00:00:00.000000000 Z
11
+ date: 2020-06-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -315,8 +315,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
315
315
  - !ruby/object:Gem::Version
316
316
  version: '0'
317
317
  requirements: []
318
- rubyforge_project:
319
- rubygems_version: 2.7.10
318
+ rubygems_version: 3.0.8
320
319
  signing_key:
321
320
  specification_version: 4
322
321
  summary: Spell check your source code