Skip to content

Upgrade RuboCop related gems #3367

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
4 changes: 3 additions & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
inherit_gem:
rubocop-shopify: rubocop.yml

require:
plugins:
- rubocop-sorbet
- rubocop-md
- rubocop-minitest
- rubocop-rake

require:
- ./lib/rubocop/cop/ruby_lsp/use_language_server_aliases
Copy link
Contributor

Choose a reason for hiding this comment

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

Could we migrate these as plugins?

- ./lib/rubocop/cop/ruby_lsp/use_register_with_handler_method

Expand Down
10 changes: 5 additions & 5 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ group :development do
gem "mocha", "~> 2.3"
gem "psych", "~> 5.1", require: false
gem "rake", "~> 13.2"
gem "rubocop-md", "~> 1.2.0", require: false
gem "rubocop-minitest", "~> 0.36.0", require: false
gem "rubocop-rake", "~> 0.6.0", require: false
gem "rubocop-shopify", "~> 2.15", require: false
gem "rubocop-sorbet", "~> 0.8", require: false
gem "rubocop-md", "~> 2.0", require: false
gem "rubocop-minitest", "~> 0.38", require: false
gem "rubocop-rake", "~> 0.7", require: false
gem "rubocop-shopify", "~> 2.16", require: false
gem "rubocop-sorbet", "~> 0.10", require: false
gem "rubocop", "~> 1.70"
gem "simplecov", require: false
gem "syntax_tree", ">= 6.1.1", "< 7"
Expand Down
46 changes: 25 additions & 21 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ GEM
remote: https://rubygems.org/
specs:
ansi (1.5.0)
ast (2.4.2)
ast (2.4.3)
benchmark (0.4.0)
builder (3.3.0)
date (3.4.1)
Expand Down Expand Up @@ -39,7 +39,7 @@ GEM
ruby2_keywords (>= 0.0.5)
netrc (0.11.0)
parallel (1.26.3)
parser (3.3.7.1)
parser (3.3.7.4)
ast (~> 2.4.1)
racc
power_assert (2.0.5)
Expand All @@ -65,29 +65,33 @@ GEM
regexp_parser (2.10.0)
reline (0.6.0)
io-console (~> 0.5)
rubocop (1.72.0)
rubocop (1.75.2)
json (~> 2.3)
language_server-protocol (~> 3.17.0.2)
lint_roller (~> 1.1.0)
parallel (~> 1.10)
parser (>= 3.3.0.2)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 2.9.3, < 3.0)
rubocop-ast (>= 1.38.0, < 2.0)
rubocop-ast (>= 1.44.0, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 4.0)
rubocop-ast (1.38.0)
parser (>= 3.3.1.0)
rubocop-md (1.2.4)
rubocop (>= 1.45)
rubocop-minitest (0.36.0)
rubocop (>= 1.61, < 2.0)
rubocop-ast (>= 1.31.1, < 2.0)
rubocop-rake (0.6.0)
rubocop (~> 1.0)
rubocop-shopify (2.15.1)
rubocop (~> 1.51)
rubocop-sorbet (0.8.7)
rubocop-ast (1.44.0)
parser (>= 3.3.7.2)
prism (~> 1.4)
rubocop-md (2.0.0)
lint_roller (~> 1.1)
rubocop (>= 1.72.1)
rubocop-minitest (0.38.0)
lint_roller (~> 1.1)
rubocop (>= 1.75.0, < 2.0)
rubocop-ast (>= 1.38.0, < 2.0)
rubocop-rake (0.7.1)
lint_roller (~> 1.1)
rubocop (>= 1.72.1)
rubocop-shopify (2.16.0)
rubocop (~> 1.62)
rubocop-sorbet (0.10.0)
rubocop (>= 1)
ruby-progressbar (1.13.0)
ruby2_keywords (0.0.5)
Expand Down Expand Up @@ -151,11 +155,11 @@ DEPENDENCIES
psych (~> 5.1)
rake (~> 13.2)
rubocop (~> 1.70)
rubocop-md (~> 1.2.0)
rubocop-minitest (~> 0.36.0)
rubocop-rake (~> 0.6.0)
rubocop-shopify (~> 2.15)
rubocop-sorbet (~> 0.8)
rubocop-md (~> 2.0)
rubocop-minitest (~> 0.38)
rubocop-rake (~> 0.7)
rubocop-shopify (~> 2.16)
rubocop-sorbet (~> 0.10)
ruby-lsp!
simplecov
sorbet-static-and-runtime
Expand Down
6 changes: 5 additions & 1 deletion lib/ruby_lsp/requests/support/rubocop_runner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,11 @@ def run(path, contents)
rescue ::RuboCop::ValidationError => error
raise ConfigurationError, error.message
rescue StandardError => error
raise InternalRuboCopError, error
# Maintain the original backtrace so that debugging cops that are breaking is easier, but re-raise as a
# different error class
internal_error = InternalRuboCopError.new(error)
internal_error.set_backtrace(error.backtrace)
raise internal_error
Comment on lines +114 to +118
Copy link
Member Author

Choose a reason for hiding this comment

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

While trying to understand if the bug I was seeing was in our code or in RuboCop's, I noticed that we were discarding the original backtrace for internal RuboCop errors.

That's not good, because we want to help people fix bugs in cops and not just point the backtrace to our own code. Here I changed to use set_backtrace to ensure that the original backtrace is preserved, which helps debugging problematic cops.

end

#: -> String
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

156 changes: 155 additions & 1 deletion sorbet/rbi/gems/[email protected]

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading