Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add job for CI using Prism parser #110

Merged
merged 1 commit into from
Apr 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,24 @@ jobs:
ruby-version: "3.3"
bundler-cache: true
- run: NO_COVERAGE=true bundle exec rake ${{ matrix.task }}

prism:
runs-on: ubuntu-latest
name: Prism
steps:
- uses: actions/checkout@v4
- name: Use prism parser
run: |
cat << EOF > Gemfile.local
gem 'prism'
EOF
- name: set up Ruby
uses: ruby/setup-ruby@v1
with:
# Specify the minimum Ruby version 2.7 required for Prism to run.
ruby-version: 2.7
bundler-cache: true
- name: spec
env:
PARSER_ENGINE: parser_prism
run: NO_COVERAGE=true bundle exec rake
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,10 @@
end

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

context 'with ternary operator' do
# FIXME: `undefined method `[]' for nil` occurs Prism 0.24.0.
# It has been resolved in the development line.
# This will be resolved in Prism > 0.24.0 and higher releases.
context 'with ternary operator', broken_on: :prism do
it 'does not flag the call' do
expect_no_offenses(<<~RUBY)
can_create_user? ? create(:user) : nil
Expand Down
4 changes: 4 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ module SpecHelper
# Run focused tests with `fdescribe`, `fit`, `:focus` etc.
config.filter_run_when_matching :focus

if ENV['PARSER_ENGINE'] == 'parser_prism'
config.filter_run_excluding broken_on: :prism
end

# We should address configuration warnings when we upgrade
config.raise_errors_for_deprecations!

Expand Down