Skip to content

Commit de6e47f

Browse files
committed
Add job for CI using Prism parser
Follow up rubocop/rubocop-ast#277
1 parent 866f2b2 commit de6e47f

File tree

3 files changed

+33
-2
lines changed

3 files changed

+33
-2
lines changed

.github/workflows/main.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,3 +75,24 @@ jobs:
7575
ruby-version: "3.3"
7676
bundler-cache: true
7777
- run: NO_COVERAGE=true bundle exec rake ${{ matrix.task }}
78+
79+
prism:
80+
runs-on: ubuntu-latest
81+
name: Prism
82+
steps:
83+
- uses: actions/checkout@v4
84+
- name: Use prism parser
85+
run: |
86+
cat << EOF > Gemfile.local
87+
gem 'prism'
88+
EOF
89+
- name: set up Ruby
90+
uses: ruby/setup-ruby@v1
91+
with:
92+
# Specify the minimum Ruby version 2.7 required for Prism to run.
93+
ruby-version: 2.7
94+
bundler-cache: true
95+
- name: spec
96+
env:
97+
PARSER_ENGINE: parser_prism
98+
run: NO_COVERAGE=true bundle exec rake

spec/rubocop/cop/factory_bot/consistent_parentheses_style_spec.rb

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,10 @@
201201
end
202202

203203
%w[&& ||].each do |operator|
204-
context "with #{operator}" do
204+
# FIXME: `undefined method `[]' for nil` occurs Prism 0.24.0.
205+
# It has been resolved in the development line.
206+
# This will be resolved in Prism > 0.24.0 and higher releases.
207+
context "with #{operator}", broken_on: :prism do
205208
it 'does not flag the call' do
206209
expect_no_offenses(<<~RUBY)
207210
can_create_user? #{operator} create(:user)
@@ -210,7 +213,10 @@
210213
end
211214
end
212215

213-
context 'with ternary operator' do
216+
# FIXME: `undefined method `[]' for nil` occurs Prism 0.24.0.
217+
# It has been resolved in the development line.
218+
# This will be resolved in Prism > 0.24.0 and higher releases.
219+
context 'with ternary operator', broken_on: :prism do
214220
it 'does not flag the call' do
215221
expect_no_offenses(<<~RUBY)
216222
can_create_user? ? create(:user) : nil

spec/spec_helper.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ module SpecHelper
3232
# Run focused tests with `fdescribe`, `fit`, `:focus` etc.
3333
config.filter_run_when_matching :focus
3434

35+
if ENV['PARSER_ENGINE'] == 'parser_prism'
36+
config.filter_run_excluding broken_on: :prism
37+
end
38+
3539
# We should address configuration warnings when we upgrade
3640
config.raise_errors_for_deprecations!
3741

0 commit comments

Comments
 (0)