Skip to content

Stop loading non-library RBS files #1148

@soutaro

Description

@soutaro

Using RBS based tools like rbs_rails and steep requires adding gem entries in rbs_collection.yaml.

gems:
  - name: rbs
    ignore: true
  - name: steep
    ignore: true

This is annoying and causes problems, and it looks wired because the gems section is mainly used to ignore libraries.

I'd like to propose changing the library RBS loading protocol:

  • Skip loading RBS files from gems that is declared in Gemfile with require: false

require: false is usually written for gems that is not loaded from the application, especially in Rails apps, and we can use it as a marker that implies RBS files of the gems are unnecessary.

The steps to load RBS of libraries will be as following:

  1. Require gems that is declared in gems section of rbs_collection.yaml without ignore: true
  2. Require gems and their dependencies from Bundler context that doesn't have require: false (and skip if it's ignored)

With this change, the rbs_rails and steep users would change their Gemfile lines as:

gem 'steep', require: false
gem 'rbs_rails', require: false

It looks better and more intuitive than having ignore: true lines in rbs_collection.yaml. 😄

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions