syntax_suggest 2.0.0 → 2.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7b3d83011e29784a7ea97dcae359b654ec8be6382c9fda7a5114353050ef5bf2
4
- data.tar.gz: a2452866035aa4751948ac4f30cb7699352bc0778fb4b5bcae3ce3f421b901de
3
+ metadata.gz: 31364a29219b203328a466f55c6053c42aab83e79df39eeffc40755d6a33de9c
4
+ data.tar.gz: 1e169f8b9ab90c79b4c12cec51218fc41b6d1629e43749f212a40743690a1a8a
5
5
  SHA512:
6
- metadata.gz: 52168116c672ee83619f59d1f158101adb64c650770424c3bd855fafb71131f72663c8afd060f8512bbe908fae2ecb8dea5a65c9384b980843c89901f70e202a
7
- data.tar.gz: 5edfacbb66e7b37dc36f1b57de325ffea4656102b3a4638249577fb8c12460c2e05a3f7761675966e845214db891c83f5b51eef963d35da506478af7f0837874
6
+ metadata.gz: 1e88d0cdc9c56b1df7316434ef2b14e2c761eba7cbf8608f1cd4e98c074f7505622d18ef9ba39e6b9737da8d8d6a98fe79d0031f0b6b99feedb984fc83aeddad
7
+ data.tar.gz: 79cf1b4f31fb231c3a56c06157604bb29d0f38ea18c635ef3d02b9ada8e80ec4387489608ef921d97bfa7cb16dbefecb6ece1c50d0895096cda3427ebc352f64
@@ -4,3 +4,5 @@ updates:
4
4
  directory: '/'
5
5
  schedule:
6
6
  interval: 'weekly'
7
+ labels:
8
+ - 'skip changelog'
@@ -13,7 +13,7 @@ jobs:
13
13
  !contains(github.event.pull_request.body, '[skip ci]') &&
14
14
  !contains(github.event.pull_request.labels.*.name, 'skip changelog')
15
15
  steps:
16
- - uses: actions/checkout@v4.1.1
16
+ - uses: actions/checkout@v4.2.2
17
17
  - name: Check that CHANGELOG is touched
18
18
  run: |
19
19
  git fetch origin ${{ github.base_ref }} --depth 1 && \
@@ -9,7 +9,7 @@ jobs:
9
9
  runs-on: ubuntu-latest
10
10
  steps:
11
11
  - name: Checkout code
12
- uses: actions/checkout@v4.1.1
12
+ uses: actions/checkout@v4.2.2
13
13
  - name: Set up Ruby
14
14
  uses: ruby/setup-ruby@v1
15
15
  with:
@@ -34,7 +34,7 @@ jobs:
34
34
  ruby: ${{ fromJson(needs.ruby-versions.outputs.versions) }}
35
35
  steps:
36
36
  - name: Checkout code
37
- uses: actions/checkout@v4.1.1
37
+ uses: actions/checkout@v4.2.2
38
38
  - name: Set up Ruby
39
39
  uses: ruby/setup-ruby@v1
40
40
  with:
@@ -53,7 +53,7 @@ jobs:
53
53
  ruby: ${{ fromJson(needs.ruby-versions.outputs.versions) }}
54
54
  steps:
55
55
  - name: Checkout code
56
- uses: actions/checkout@v4.1.1
56
+ uses: actions/checkout@v4.2.2
57
57
  - name: Set up Ruby
58
58
  uses: ruby/setup-ruby@v1
59
59
  with:
data/.gitignore CHANGED
@@ -7,8 +7,8 @@
7
7
  /spec/reports/
8
8
  /tmp/
9
9
  scratch.rb
10
+ /*.lock
10
11
 
11
12
  # rspec failure tracking
12
13
  .rspec_status
13
14
  .DS_Store
14
-
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  ## HEAD (unreleased)
2
2
 
3
+ ## 2.0.2
4
+
5
+ - Fix: Separate multiple parser errors by newline. (https://github.com/ruby/syntax_suggest/pull/232)
6
+
7
+ ## 2.0.1
8
+
9
+ - Fix CLI failure when shipped with default gems. (https://github.com/ruby/syntax_suggest/pull/226 and https://github.com/ruby/syntax_suggest/pull/227)
10
+
3
11
  ## 2.0.0
4
12
 
5
13
  - Changed: No longer supports EOL versions of Ruby. (https://github.com/ruby/syntax_suggest/pull/210)
data/exe/syntax_suggest CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- require_relative "../lib/syntax_suggest/api"
3
+ require "syntax_suggest/api"
4
4
 
5
5
  SyntaxSuggest::Cli.new(
6
6
  argv: ARGV
@@ -227,6 +227,7 @@ require_relative "lex_all"
227
227
  require_relative "code_line"
228
228
  require_relative "code_block"
229
229
  require_relative "block_expand"
230
+ require_relative "mini_stringio"
230
231
  require_relative "priority_queue"
231
232
  require_relative "unvisited_lines"
232
233
  require_relative "around_block_scan"
@@ -118,7 +118,7 @@ module SyntaxSuggest
118
118
  end
119
119
 
120
120
  # Scanning is intentionally conservative because
121
- # we have no way of rolling back an agressive block (at this time)
121
+ # we have no way of rolling back an aggressive block (at this time)
122
122
  #
123
123
  # If a block was stopped for some trivial reason, (like an empty line)
124
124
  # but the next line would have caused it to be balanced then we
@@ -224,7 +224,7 @@ module SyntaxSuggest
224
224
  @scanner.lines
225
225
  end
226
226
 
227
- # Managable rspec errors
227
+ # Manageable rspec errors
228
228
  def inspect
229
229
  "#<#{self.class}:0x0000123843lol >"
230
230
  end
@@ -157,7 +157,7 @@ module SyntaxSuggest
157
157
  end
158
158
  end
159
159
 
160
- # Managable rspec errors
160
+ # Manageable rspec errors
161
161
  def inspect
162
162
  "#<SyntaxSuggest::CodeBlock:0x0000123843lol >"
163
163
  end
@@ -15,7 +15,7 @@ module SyntaxSuggest
15
15
  #
16
16
  # 1. Sanitize/format input source
17
17
  # 2. Search for invalid blocks
18
- # 3. Format invalid blocks into something meaninful
18
+ # 3. Format invalid blocks into something meaningful
19
19
  #
20
20
  # This class handles the third part.
21
21
  #
@@ -26,7 +26,7 @@ module SyntaxSuggest
26
26
  # they can't add extra data that's not present.
27
27
  #
28
28
  # In the case of known ambiguious cases, this class adds context
29
- # back to the ambiguitiy so the programmer has full information.
29
+ # back to the ambiguity so the programmer has full information.
30
30
  #
31
31
  # Beyond handling these ambiguities, it also captures surrounding
32
32
  # code context information:
@@ -10,7 +10,7 @@ module SyntaxSuggest
10
10
  #
11
11
  # 1. Sanitize/format input source
12
12
  # 2. Search for invalid blocks
13
- # 3. Format invalid blocks into something meaninful
13
+ # 3. Format invalid blocks into something meaningful
14
14
  #
15
15
  # This class handles the first part.
16
16
  #
@@ -267,7 +267,7 @@ module SyntaxSuggest
267
267
  groups.each do |lines|
268
268
  line = lines.first
269
269
 
270
- # Handle the case of multiple groups in a a row
270
+ # Handle the case of multiple groups in a row
271
271
  # if one is already replaced, move on
272
272
  next if @document[line.index].empty?
273
273
 
@@ -8,7 +8,7 @@ module SyntaxSuggest
8
8
  #
9
9
  # 1. Sanitize/format input source
10
10
  # 2. Search for invalid blocks
11
- # 3. Format invalid blocks into something meaninful
11
+ # 3. Format invalid blocks into something meaningful
12
12
  #
13
13
  # The Code frontier is a critical part of the second step
14
14
  #
@@ -3,24 +3,6 @@
3
3
  # Ruby 3.2+ has a cleaner way to hook into Ruby that doesn't use `require`
4
4
  if SyntaxError.method_defined?(:detailed_message)
5
5
  module SyntaxSuggest
6
- # Mini String IO [Private]
7
- #
8
- # Acts like a StringIO with reduced API, but without having to require that
9
- # class.
10
- class MiniStringIO
11
- def initialize(isatty: $stderr.isatty)
12
- @string = +""
13
- @isatty = isatty
14
- end
15
-
16
- attr_reader :isatty
17
- def puts(value = $/, **)
18
- @string << value
19
- end
20
-
21
- attr_reader :string
22
- end
23
-
24
6
  # SyntaxSuggest.module_for_detailed_message [Private]
25
7
  #
26
8
  # Used to monkeypatch SyntaxError via Module.prepend
@@ -28,7 +28,7 @@ module SyntaxSuggest
28
28
  @is_end = false
29
29
  @is_kw = false
30
30
  return if type != :on_kw
31
- #
31
+
32
32
  return if last_lex && last_lex.fname? # https://github.com/ruby/ruby/commit/776759e300e4659bb7468e2b97c8c2d4359a2953
33
33
 
34
34
  case token
@@ -0,0 +1,30 @@
1
+ # frozen_string_literal: true
2
+
3
+ module SyntaxSuggest
4
+ # Mini String IO [Private]
5
+ #
6
+ # Acts like a StringIO with reduced API, but without having to require that
7
+ # class.
8
+ #
9
+ # The original codebase emitted directly to $stderr, but now SyntaxError#detailed_message
10
+ # needs a string output. To accomplish that we kept the original print infrastructure in place and
11
+ # added this class to accumulate the print output into a string.
12
+ class MiniStringIO
13
+ EMPTY_ARG = Object.new
14
+
15
+ def initialize(isatty: $stderr.isatty)
16
+ @string = +""
17
+ @isatty = isatty
18
+ end
19
+
20
+ attr_reader :isatty
21
+ def puts(value = EMPTY_ARG, **)
22
+ if !value.equal?(EMPTY_ARG)
23
+ @string << value
24
+ end
25
+ @string << $/
26
+ end
27
+
28
+ attr_reader :string
29
+ end
30
+ end
@@ -8,7 +8,7 @@ module SyntaxSuggest
8
8
  # grabbing one that contains only an "end". In this example:
9
9
  #
10
10
  # def dog
11
- # begonn # mispelled `begin`
11
+ # begonn # misspelled `begin`
12
12
  # puts "bark"
13
13
  # end
14
14
  # end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SyntaxSuggest
4
- VERSION = "2.0.0"
4
+ VERSION = "2.0.2"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: syntax_suggest
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - schneems
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-12-08 00:00:00.000000000 Z
11
+ date: 2024-11-15 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: When you get an "unexpected end" in your syntax this gem helps you find
14
14
  it
@@ -28,7 +28,6 @@ files:
28
28
  - CHANGELOG.md
29
29
  - CODE_OF_CONDUCT.md
30
30
  - Gemfile
31
- - Gemfile.lock
32
31
  - LICENSE.txt
33
32
  - README.md
34
33
  - Rakefile
@@ -58,6 +57,7 @@ files:
58
57
  - lib/syntax_suggest/left_right_lex_count.rb
59
58
  - lib/syntax_suggest/lex_all.rb
60
59
  - lib/syntax_suggest/lex_value.rb
60
+ - lib/syntax_suggest/mini_stringio.rb
61
61
  - lib/syntax_suggest/parse_blocks_from_indent_line.rb
62
62
  - lib/syntax_suggest/pathname_from_message.rb
63
63
  - lib/syntax_suggest/priority_engulf_queue.rb
@@ -88,7 +88,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
88
88
  - !ruby/object:Gem::Version
89
89
  version: '0'
90
90
  requirements: []
91
- rubygems_version: 3.4.22
91
+ rubygems_version: 3.5.23
92
92
  signing_key:
93
93
  specification_version: 4
94
94
  summary: Find syntax errors in your source in a snap
data/Gemfile.lock DELETED
@@ -1,85 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- syntax_suggest (2.0.0)
5
-
6
- GEM
7
- remote: https://rubygems.org/
8
- specs:
9
- ast (2.4.2)
10
- benchmark-ips (2.12.0)
11
- diff-lcs (1.5.0)
12
- json (2.7.0)
13
- language_server-protocol (3.17.0.3)
14
- lint_roller (1.1.0)
15
- parallel (1.23.0)
16
- parser (3.2.2.4)
17
- ast (~> 2.4.1)
18
- racc
19
- prism (0.18.0)
20
- racc (1.7.3)
21
- rainbow (3.1.1)
22
- rake (12.3.3)
23
- regexp_parser (2.8.3)
24
- rexml (3.2.6)
25
- rspec (3.12.0)
26
- rspec-core (~> 3.12.0)
27
- rspec-expectations (~> 3.12.0)
28
- rspec-mocks (~> 3.12.0)
29
- rspec-core (3.12.2)
30
- rspec-support (~> 3.12.0)
31
- rspec-expectations (3.12.3)
32
- diff-lcs (>= 1.2.0, < 2.0)
33
- rspec-support (~> 3.12.0)
34
- rspec-mocks (3.12.6)
35
- diff-lcs (>= 1.2.0, < 2.0)
36
- rspec-support (~> 3.12.0)
37
- rspec-support (3.12.1)
38
- rubocop (1.57.2)
39
- json (~> 2.3)
40
- language_server-protocol (>= 3.17.0)
41
- parallel (~> 1.10)
42
- parser (>= 3.2.2.4)
43
- rainbow (>= 2.2.2, < 4.0)
44
- regexp_parser (>= 1.8, < 3.0)
45
- rexml (>= 3.2.5, < 4.0)
46
- rubocop-ast (>= 1.28.1, < 2.0)
47
- ruby-progressbar (~> 1.7)
48
- unicode-display_width (>= 2.4.0, < 3.0)
49
- rubocop-ast (1.30.0)
50
- parser (>= 3.2.1.0)
51
- rubocop-performance (1.19.1)
52
- rubocop (>= 1.7.0, < 2.0)
53
- rubocop-ast (>= 0.4.0)
54
- ruby-prof (1.6.3)
55
- ruby-progressbar (1.13.0)
56
- stackprof (0.2.25)
57
- standard (1.32.1)
58
- language_server-protocol (~> 3.17.0.2)
59
- lint_roller (~> 1.0)
60
- rubocop (~> 1.57.2)
61
- standard-custom (~> 1.0.0)
62
- standard-performance (~> 1.2)
63
- standard-custom (1.0.2)
64
- lint_roller (~> 1.0)
65
- rubocop (~> 1.50)
66
- standard-performance (1.2.1)
67
- lint_roller (~> 1.1)
68
- rubocop-performance (~> 1.19.1)
69
- unicode-display_width (2.5.0)
70
-
71
- PLATFORMS
72
- ruby
73
-
74
- DEPENDENCIES
75
- benchmark-ips
76
- prism
77
- rake (~> 12.0)
78
- rspec (~> 3.0)
79
- ruby-prof
80
- stackprof
81
- standard
82
- syntax_suggest!
83
-
84
- BUNDLED WITH
85
- 2.4.21