syntax_suggest 2.0.2 → 2.0.3

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: 31364a29219b203328a466f55c6053c42aab83e79df39eeffc40755d6a33de9c
4
- data.tar.gz: 1e169f8b9ab90c79b4c12cec51218fc41b6d1629e43749f212a40743690a1a8a
3
+ metadata.gz: de1d75012724df4b1222ba39772c0fbfb6205cfd8713dd4f19ff53e473d7e4f3
4
+ data.tar.gz: 1a705bbd28e351a682343089c14a2277953d917725f970eaa7884912a093be45
5
5
  SHA512:
6
- metadata.gz: 1e88d0cdc9c56b1df7316434ef2b14e2c761eba7cbf8608f1cd4e98c074f7505622d18ef9ba39e6b9737da8d8d6a98fe79d0031f0b6b99feedb984fc83aeddad
7
- data.tar.gz: 79cf1b4f31fb231c3a56c06157604bb29d0f38ea18c635ef3d02b9ada8e80ec4387489608ef921d97bfa7cb16dbefecb6ece1c50d0895096cda3427ebc352f64
6
+ metadata.gz: d883c10ef026cfe8c26c930d0857ef02f7655421cdd83f69bd971e231f674124fcca4957032f0a9311c87d2fd798ffb7b9921aee6e9859b112213cfda0c48cd5
7
+ data.tar.gz: e3d0a25404aa3ea0a802400ee42b3d8337f9180420772409e920683dd631e59c8c2f98bcf85a107dcb3ba888246a3962aeb7ca7ec036b3d0b08e17496406f145
@@ -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.2.2
16
+ - uses: actions/checkout@v6
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.2.2
12
+ uses: actions/checkout@v6
13
13
  - name: Set up Ruby
14
14
  uses: ruby/setup-ruby@v1
15
15
  with:
@@ -32,14 +32,23 @@ jobs:
32
32
  fail-fast: false
33
33
  matrix:
34
34
  ruby: ${{ fromJson(needs.ruby-versions.outputs.versions) }}
35
+ prism_version:
36
+ - 1.2.0 # Shipped with Ruby 3.4 as default parser https://www.ruby-lang.org/en/news/2024/12/25/ruby-3-4-0-released/
37
+ - 1.8.0
38
+ - head
39
+ env:
40
+ PRISM_VERSION: ${{ matrix.prism_version }}
35
41
  steps:
36
42
  - name: Checkout code
37
- uses: actions/checkout@v4.2.2
43
+ uses: actions/checkout@v6
38
44
  - name: Set up Ruby
39
45
  uses: ruby/setup-ruby@v1
40
46
  with:
41
47
  ruby-version: ${{ matrix.ruby }}
42
48
  bundler-cache: true
49
+ - name: Use latest prism version (head only)
50
+ if: matrix.prism_version == 'head'
51
+ run: bundle update prism
43
52
  - name: test
44
53
  run: bin/rake test
45
54
  continue-on-error: ${{ matrix.ruby == 'head' }}
@@ -53,7 +62,7 @@ jobs:
53
62
  ruby: ${{ fromJson(needs.ruby-versions.outputs.versions) }}
54
63
  steps:
55
64
  - name: Checkout code
56
- uses: actions/checkout@v4.2.2
65
+ uses: actions/checkout@v6
57
66
  - name: Set up Ruby
58
67
  uses: ruby/setup-ruby@v1
59
68
  with:
@@ -0,0 +1,33 @@
1
+ name: Sync ruby
2
+ on:
3
+ push:
4
+ branches: [main]
5
+ jobs:
6
+ sync:
7
+ name: Sync ruby
8
+ runs-on: ubuntu-latest
9
+ if: ${{ github.repository_owner == 'ruby' }}
10
+ steps:
11
+ - uses: actions/checkout@v6
12
+
13
+ - name: Create GitHub App token
14
+ id: app-token
15
+ uses: actions/create-github-app-token@v2
16
+ with:
17
+ app-id: 2060836
18
+ private-key: ${{ secrets.RUBY_SYNC_DEFAULT_GEMS_PRIVATE_KEY }}
19
+ owner: ruby
20
+ repositories: ruby
21
+
22
+ - name: Sync to ruby/ruby
23
+ uses: convictional/trigger-workflow-and-wait@v1.6.5
24
+ with:
25
+ owner: ruby
26
+ repo: ruby
27
+ workflow_file_name: sync_default_gems.yml
28
+ github_token: ${{ steps.app-token.outputs.token }}
29
+ ref: master
30
+ client_payload: |
31
+ {"gem":"${{ github.event.repository.name }}","before":"${{ github.event.before }}","after":"${{ github.event.after }}"}
32
+ propagate_failure: true
33
+ wait_interval: 10
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  ## HEAD (unreleased)
2
2
 
3
+ ## 2.0.3
4
+
5
+ - Fix: Correctly identify trailing slashes when using Prism > 1.8.0. (https://github.com/ruby/syntax_suggest/pull/243)
6
+ - Internal: Add tests to multiple versions of prism
7
+
3
8
  ## 2.0.2
4
9
 
5
10
  - Fix: Separate multiple parser errors by newline. (https://github.com/ruby/syntax_suggest/pull/232)
data/Gemfile CHANGED
@@ -5,11 +5,19 @@ source "https://rubygems.org"
5
5
  # Specify your gem's dependencies in dead_end.gemspec
6
6
  gemspec
7
7
 
8
- gem "rake", "~> 12.0"
8
+ gem "rake", "~> 13.0"
9
9
  gem "rspec", "~> 3.0"
10
10
  gem "stackprof"
11
11
  gem "standard"
12
12
  gem "ruby-prof"
13
13
 
14
14
  gem "benchmark-ips"
15
- gem "prism"
15
+
16
+ case ENV["PRISM_VERSION"]&.strip&.downcase
17
+ when "head"
18
+ gem "prism", github: "ruby/prism"
19
+ when nil, ""
20
+ gem "prism"
21
+ else
22
+ gem "prism", ENV["PRISM_VERSION"]
23
+ end
@@ -146,11 +146,7 @@ module SyntaxSuggest
146
146
  def self.valid_without?(without_lines:, code_lines:)
147
147
  lines = code_lines - Array(without_lines).flatten
148
148
 
149
- if lines.empty?
150
- true
151
- else
152
- valid?(lines)
153
- end
149
+ lines.empty? || valid?(lines)
154
150
  end
155
151
 
156
152
  # SyntaxSuggest.invalid? [Private]
@@ -180,18 +180,17 @@ module SyntaxSuggest
180
180
  # EOM
181
181
  # expect(lines.first.trailing_slash?).to eq(true)
182
182
  #
183
- if SyntaxSuggest.use_prism_parser?
184
- def trailing_slash?
185
- last = @lex.last
186
- last&.type == :on_tstring_end
187
- end
188
- else
189
- def trailing_slash?
190
- last = @lex.last
191
- return false unless last
192
- return false unless last.type == :on_sp
183
+ def trailing_slash?
184
+ last = @lex.last
193
185
 
186
+ # Older versions of prism diverged slightly from Ripper in compatibility mode
187
+ case last&.type
188
+ when :on_sp
194
189
  last.token == TRAILING_SLASH
190
+ when :on_tstring_end
191
+ true
192
+ else
193
+ false
195
194
  end
196
195
  end
197
196
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SyntaxSuggest
4
- VERSION = "2.0.2"
4
+ VERSION = "2.0.3"
5
5
  end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: syntax_suggest
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.2
4
+ version: 2.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - schneems
8
- autorequire:
9
8
  bindir: exe
10
9
  cert_chain: []
11
- date: 2024-11-15 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies: []
13
12
  description: When you get an "unexpected end" in your syntax this gem helps you find
14
13
  it
@@ -22,6 +21,7 @@ files:
22
21
  - ".github/dependabot.yml"
23
22
  - ".github/workflows/check_changelog.yml"
24
23
  - ".github/workflows/ci.yml"
24
+ - ".github/workflows/sync-ruby.yml"
25
25
  - ".gitignore"
26
26
  - ".rspec"
27
27
  - ".standard.yml"
@@ -73,7 +73,6 @@ licenses:
73
73
  metadata:
74
74
  homepage_uri: https://github.com/ruby/syntax_suggest.git
75
75
  source_code_uri: https://github.com/ruby/syntax_suggest.git
76
- post_install_message:
77
76
  rdoc_options: []
78
77
  require_paths:
79
78
  - lib
@@ -88,8 +87,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
88
87
  - !ruby/object:Gem::Version
89
88
  version: '0'
90
89
  requirements: []
91
- rubygems_version: 3.5.23
92
- signing_key:
90
+ rubygems_version: 3.6.9
93
91
  specification_version: 4
94
92
  summary: Find syntax errors in your source in a snap
95
93
  test_files: []