How to deal with gems with integrations

Open
#1,728 0 comments 1 reaction 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
30/100
Issue type
Feature
Clarity
Needs clarification
Activity status
Stale
Tech stack
ruby
Domain
tooling

Research direction

Reproduce the report from the Steepfile by running steep check with gem_rbs_collection and the Datadog signatures. Trace how integration signatures referencing unused RSpec, Sidekiq, or Rails entities are loaded and diagnosed. Done should establish and test a supported behavior for these unused integrations or a documented way to suppress the reported errors.

Written by the indexing model from the issue text.

Description

I'm adding gem_rbs_collection to this library integrating with datadog. All is well, until I run steep check, and I get error messages coming from datadog's signatures:

# example
../../.gem/ruby/3.2.2/gems/datadog-ci-0.6.0/sig/datadog/ci/contrib/rspec/example.rbs:8:12: [error] Cannot find type `::RSpec::Core::Example`
│ Diagnostic ID: RBS::UnknownTypeName
│
└             include ::RSpec::Core::Example
              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

../../.gem/ruby/3.2.2/gems/datadog-ci-0.6.0/sig/datadog/ci/contrib/rspec/example_group.rbs:9:12: [error] Cannot find type `::RSpec::Core::ExampleGroup::ClassMethods`
│ Diagnostic ID: RBS::UnknownTypeName
│
└             include ::RSpec::Core::ExampleGroup::ClassMethods
              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The odd thing here being, I'm not using, nor loading rspec (and same for similar error I see).

The problem seems to be that datadog ships with integrations, which patch other known gems to include its tracing API. Therefore, signatures to those patch modules will include references for the things they're patching (rspec, sidekiq, even rails...), which they can deal with in their own env/CI, but I shouldn't have to, as I'm not using rspec, sidekiq or rais.

Seems that rbs needs to find a way to gracefully ignore signatures for entities which do not exist in a given environment. Either that, or I have to be able to ignore errors such as the one above, as they're not referring by the check call in the Steepfile.

Dominant language
Ruby
Stars
2.2k
Forks
263
Avg merge
1d 20h
Merged PRs (30d)
64

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from ruby/rbs

All issues in ruby/rbs

Similar issues

More Ruby issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.