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

RuboCop RBI appears to be pulling in rubocop-rspec when typechecking #1982

Open
p-linnane opened this issue Aug 7, 2024 · 3 comments
Open

Comments

@p-linnane
Copy link

Hello 👋 . I'm a maintainer for the Homebrew project. This is my first issue in the Tapioca repo, so please bear with me if I haven't filled this out properly.

While updating to RuboCop v1.65.1, we are encountering typechecking failures. The RuboCop RBI appears to be trying to pull in rubocop-rspec.

Run brew typecheck
sorbet/rbi/gems/[email protected]:29637: Unable to resolve constant `Base` https://srb.help/5002
       29637 |class RuboCop::Cop::RSpec::MultipleExpectations < ::RuboCop::Cop::RSpec::Base
                                                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  Did you mean `RuboCop::Cop::Base`? Use `-a` to autocorrect
    sorbet/rbi/gems/[email protected]:29637: Replace with `RuboCop::Cop::Base`
       29637 |class RuboCop::Cop::RSpec::MultipleExpectations < ::RuboCop::Cop::RSpec::Base
                                                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^
    sorbet/rbi/gems/[email protected]:2929: `RuboCop::Cop::Base` defined here
    2929 |class RuboCop::Cop::Base
          ^^^^^^^^^^^^^^^^^^^^^^^^

sorbet/rbi/gems/[email protected]:29671: Unable to resolve constant `Base` https://srb.help/5002
       29671 |class RuboCop::Cop::RSpec::MultipleMemoizedHelpers < ::RuboCop::Cop::RSpec::Base
                                                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  Did you mean `RuboCop::Cop::Base`? Use `-a` to autocorrect
    sorbet/rbi/gems/[email protected]:29671: Replace with `RuboCop::Cop::Base`
       29671 |class RuboCop::Cop::RSpec::MultipleMemoizedHelpers < ::RuboCop::Cop::RSpec::Base
                                                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^
    sorbet/rbi/gems/[email protected]:2929: `RuboCop::Cop::Base` defined here
    2929 |class RuboCop::Cop::Base
          ^^^^^^^^^^^^^^^^^^^^^^^^

sorbet/rbi/gems/[email protected]:29702: Unable to resolve constant `Base` https://srb.help/5002
       29702 |class RuboCop::Cop::RSpec::NestedGroups < ::RuboCop::Cop::RSpec::Base
                                                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  Did you mean `RuboCop::Cop::Base`? Use `-a` to autocorrect
    sorbet/rbi/gems/[email protected]:29702: Replace with `RuboCop::Cop::Base`
       29702 |class RuboCop::Cop::RSpec::NestedGroups < ::RuboCop::Cop::RSpec::Base
                                                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^
    sorbet/rbi/gems/[email protected]:2929: `RuboCop::Cop::Base` defined here
    2929 |class RuboCop::Cop::Base
          ^^^^^^^^^^^^^^^^^^^^^^^^
Errors: 3
Check https://docs.brew.sh/Typechecking for more information on how to resolve these errors.

You can view our CI run here for exactly what's happening: https://github.com/Homebrew/brew/actions/runs/10239923250/job/28326083691?pr=17928

@andyw8 andyw8 changed the title RuboCop RBI appears to be pulling in rubocop-rpec when typechecking RuboCop RBI appears to be pulling in rubocop-rspec when typechecking Aug 8, 2024
@egiurleo egiurleo assigned egiurleo and unassigned egiurleo Aug 15, 2024
@egiurleo
Copy link
Contributor

Hi, @p-linnane, we're currently working on solving this as part of #293. The issue is that Tapioca is attributing these methods to the rubocop gem rather than rubocop-rspec, which is why it's writing the methods in this RBI file.

Let me know if these errors are blocking you and you need help finding a workaround!

@p-linnane
Copy link
Author

Hi @egiurleo. We are not currently able to upgrade RuboCop for Homebrew while this issue persists. I'll keep an eye on the PR you linked.

@egiurleo
Copy link
Contributor

I'll follow up once the new behavior is ready to be tested to make sure it solves your use case.

In the meantime, you might consider overriding the strictness level of rubocop gem RBI so that it won't cause type errors. It's not a good long-term solution because obviously you lose some type safety, but it's helpful for temporary unblocking.

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

No branches or pull requests

2 participants