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 Spoom backtrace filter #965

Merged
merged 1 commit into from
Sep 20, 2023
Merged

Conversation

andyw8
Copy link
Contributor

@andyw8 andyw8 commented Sep 1, 2023

Motivation

Use the new Sorbet backtrace filter added in Shopify/spoom#457

Implementation

bundle update spoom then update test_helper.rb and require.rb

Automated Tests

n/a

Manual Tests

n/a

@andyw8 andyw8 force-pushed the andyw8/use-spoom-backtrace-filter branch from 8834656 to 38567a2 Compare September 1, 2023 19:02
@andyw8
Copy link
Contributor Author

andyw8 commented Sep 5, 2023

Shopify/spoom#457 has been merged – I'll keep this open until it's available in the next release, then update.

@Morriar
Copy link
Contributor

Morriar commented Sep 5, 2023

One question though, currently Spoom as a runtime dependency on sorbet-static, are we sure we want to import this transitive dependency to the Ruby LSP?

We could make Spoom not depend on sorbet-static in its Gemfile and just assume it would be here, but that causes problems regarding versions requirements that we would need to address first.

@andyw8
Copy link
Contributor Author

andyw8 commented Sep 5, 2023

@Morriar the spoom dependency via tapioca, which is a :development dependency in the Gemfile, so I don't think that should be a concern?

@Morriar
Copy link
Contributor

Morriar commented Sep 5, 2023

Won't you have to make Spoom a runtime dependency is you want to require some code from it?

@Morriar
Copy link
Contributor

Morriar commented Sep 5, 2023

As long as we only require this from the tests it's okay 👍

@andyw8 andyw8 force-pushed the andyw8/use-spoom-backtrace-filter branch 3 times, most recently from 067416d to 29180eb Compare September 15, 2023 19:09
@andyw8 andyw8 marked this pull request as ready for review September 15, 2023 19:09
@andyw8 andyw8 requested a review from a team as a code owner September 15, 2023 19:09
@andyw8
Copy link
Contributor Author

andyw8 commented Sep 15, 2023

I don't understand why it's failing on Window...

D:/a/ruby-lsp/ruby-lsp/test/test_helper.rb:15:in `require': cannot load such file -- spoom/backtrace_filter/minitest (LoadError)

@andyw8 andyw8 force-pushed the andyw8/use-spoom-backtrace-filter branch from 29180eb to 9a093dc Compare September 19, 2023 20:24
@vinistock
Copy link
Member

Because Spoom is not available on Windows. That will need to be a conditional require.

@andyw8 andyw8 force-pushed the andyw8/use-spoom-backtrace-filter branch from 9a093dc to f6adfc5 Compare September 19, 2023 22:23
@andyw8 andyw8 force-pushed the andyw8/use-spoom-backtrace-filter branch from f6adfc5 to acb4f28 Compare September 20, 2023 13:05
Comment on lines 38 to 34
if defined? Spoom::BacktraceFilter::Minitest
Minitest.backtrace_filter = Spoom::BacktraceFilter::Minitest.new
Copy link
Member

Choose a reason for hiding this comment

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

How about avoiding two checks and just doing everything in the same block?

begin
  require "spoom/backtrace_filter/minitest"
  Minitest.backtrace_filter = Spoom::BacktraceFilter::Minitest.new
rescue LoadError
  # Tapioca (and thus Spoom) is not available on Windows
end

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 we can do that, updated.

@andyw8 andyw8 force-pushed the andyw8/use-spoom-backtrace-filter branch from acb4f28 to 7093660 Compare September 20, 2023 13:46
@andyw8 andyw8 enabled auto-merge (squash) September 20, 2023 13:47
@andyw8 andyw8 merged commit 18f8610 into main Sep 20, 2023
29 checks passed
@andyw8 andyw8 deleted the andyw8/use-spoom-backtrace-filter branch September 20, 2023 13:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants