-
-
Notifications
You must be signed in to change notification settings - Fork 278
Consider prism in coverage results #2079
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,28 +35,45 @@ jobs: | |
- "3.4" | ||
- ruby-head | ||
- jruby-9.4 | ||
task: | ||
- internal_investigation | ||
- spec | ||
name: "Ruby ${{ matrix.ruby }}: ${{ matrix.task }}" | ||
parser_engine: | ||
- parser_whitequark | ||
include: | ||
- ruby: "2.7" # Minimum version required for Prism to run. | ||
parser_engine: parser_prism | ||
name: "Ruby ${{ matrix.ruby }} - Spec (${{ matrix.parser_engine }})" | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: ruby/setup-ruby@v1 | ||
with: | ||
ruby-version: "${{ matrix.ruby }}" | ||
bundler-cache: true | ||
- run: NO_COVERAGE=true bundle exec rake ${{ matrix.task }} | ||
- run: bundle exec rake spec | ||
env: | ||
PARSER_ENGINE: ${{ matrix.parser_engine }} | ||
- name: Upload Coverage Artifact | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we're quite fine if it just fails. @rubocop/rubocop-rspec WDYT? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Yeah, I can do that. |
||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: coverage-ubuntu-${{ matrix.ruby }}-${{ matrix.parser_engine }} | ||
path: coverage/.resultset.json | ||
include-hidden-files: true | ||
|
||
coverage: | ||
name: Check Coverage | ||
needs: main | ||
runs-on: ubuntu-latest | ||
name: "Test coverage" | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/download-artifact@v4 | ||
name: Download Coverage Artifacts | ||
with: | ||
pattern: coverage-* | ||
- uses: ruby/setup-ruby@v1 | ||
with: | ||
ruby-version: "3.4" | ||
ruby-version: ruby # Latest stable CRuby version | ||
bundler-cache: true | ||
- run: bundle exec rake spec | ||
|
||
- run: bundle exec rake coverage:ci | ||
|
||
edge-rubocop: | ||
runs-on: ubuntu-latest | ||
|
@@ -122,24 +139,3 @@ jobs: | |
ruby-version: "3.4" | ||
bundler-cache: true | ||
- run: NO_COVERAGE=true bundle exec rake spec | ||
|
||
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 | ||
- env: | ||
NO_COVERAGE: true | ||
PARSER_ENGINE: parser_prism | ||
run: bundle exec rake spec |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# frozen_string_literal: true | ||
|
||
namespace :coverage do | ||
desc 'Report Coverage from merged CI runs' | ||
task :ci do | ||
require 'simplecov' | ||
|
||
SimpleCov.collate Dir['coverage-*/.resultset.json'] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Will this combine results from different Ruby versions, and Parser results with Prism results? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes. Different ruby versions aren't really needed since it will be at 100% with just two jobs right now (one prism, one parser) but limiting it in the workflow adds complexity which I don't think is really needed. Just doing it will all runs seems ok to me for simplicity. |
||
end | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://github.com/rubocop/rubocop/blob/d8448a3790a78f16536e267ed7ea5ffc2e03561b/docs/modules/ROOT/pages/compatibility.adoc#L44
What is the point for us to run this job on 2.7, and tell the Prism to analyze the code as it was Ruby 3.4? Don't we have those 3.4-specific (eg it-block) specs disabled when running on Ruby 2.7?
Is it just my OCD, or we need two Prism jobs, one on 2.7, to ensure it runs on older rubies, and one on 3.4, to ensure cops do what we expect them to, including new features, with Prism?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's just the ruby version that it is being run on. So even with a runtime of Ruby 2.7 it will analyze it as syntax from those ruby versions like parser would do it (in practise it will "upgrade" 2.7 and other versions it can't anaylze to 3.3, which is the lowest ruby version that prism understands)
It's the lowest to not accidentally use newer ruby features like you mentioned. It will still analyze such newer ruby versions even with a lower runtime ruby.