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

Use Prism parser engine #621

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 5 additions & 5 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ PATH
remote: .
specs:
rubocop-shopify (2.15.1)
rubocop (~> 1.51)
prism
rubocop (~> 1.62)

GEM
remote: https://rubygems.org/
Expand Down Expand Up @@ -32,20 +33,19 @@ GEM
rake (13.1.0)
regexp_parser (2.9.0)
rexml (3.2.6)
rubocop (1.61.0)
rubocop (1.62.0)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
parallel (~> 1.10)
parser (>= 3.3.0.2)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0)
rexml (>= 3.2.5, < 4.0)
rubocop-ast (>= 1.30.0, < 2.0)
rubocop-ast (>= 1.31.1, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 3.0)
rubocop-ast (1.31.0)
rubocop-ast (1.31.1)
parser (>= 3.3.0.4)
prism (>= 0.24.0)
ruby-progressbar (1.13.0)
unicode-display_width (2.5.0)

Expand Down
3 changes: 2 additions & 1 deletion rubocop-shopify.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,6 @@ Gem::Specification.new do |s|

s.required_ruby_version = ">= 2.7.0"

s.add_dependency("rubocop", "~> 1.51")
s.add_dependency("prism")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think in the final form, we would want a lower bound on the version of Prism, to make sure that we have all the bugfixes related to RuboCop translation layer in.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, agreed. I was a little surprised rubocop-ast doesn't require a minimum version. It seems like something you'd want to do if you know it won't work with versions below some minimum.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, agreed. I think once we are past v1.0 of Prism, then we should be able to add that as a minimum version. otherwise, my concern is that folks who try RuboCop with Prism as a backend on vanilla Ruby 3.3 will have a bad time, since the version of Prism released with Ruby 3.3 will be horribly out of date.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, agreed. RuboCop's bug report template asks the submitted to include the output of rubocop -V which would include the Prism version, but I don't understand why not simply restrict the version and prevent bug reports against outdated Prism versions from being opened in the first place.

s.add_dependency("rubocop", "~> 1.62")
end
1 change: 1 addition & 0 deletions rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ inherit_mode:
AllCops:
StyleGuideBaseURL: https://shopify.github.io/ruby-style-guide/
NewCops: disable # New cops will be triaged by style guide maintainers instead.
ParserEngine: parser_prism

Bundler/OrderedGems:
Enabled: false
Expand Down
1 change: 1 addition & 0 deletions test/fixtures/full_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ AllCops:
CacheRootDirectory:
AllowSymlinksInCacheRootDirectory: false
TargetRubyVersion:
ParserEngine: parser_prism
SuggestExtensions:
rubocop-rails:
- rails
Expand Down