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

uninitialized constant RubyLsp::RuboCop::Cop (NameError) #3044

Closed
abrisse opened this issue Jan 10, 2025 · 2 comments · Fixed by #3045
Closed

uninitialized constant RubyLsp::RuboCop::Cop (NameError) #3044

abrisse opened this issue Jan 10, 2025 · 2 comments · Fixed by #3045
Labels
bug Something isn't working vscode This pull request should be included in the VS Code extension's release notes

Comments

@abrisse
Copy link
Contributor

abrisse commented Jan 10, 2025

Description

Ruby LSP Information

The version 1.17.0 of the gem rubocop defines a new module RubyLsp::Rubocop. (link) that breaks several lines of code of the gem ruby-lsp.

Reproduction steps

In my Gemfile.lock:

  • rubocop (1.70.0)
  • ruby-lsp (0.23.4)
  1. Start the Ruby LSP using VSCode
  2. It fails with the following message:
Error processing initialized: .bundle/ruby/3.1.0/gems/ruby-lsp-0.23.4/lib/ruby_lsp/requests/support/rubocop_runner.rb:86:in
'initialize':uninitialized constant RubyLsp::RuboCop::Cop (NameError)

Fix

Replace all the Rubocop references within the namespace RubyLsp using the top-level namespace operand :: That's already the case on some instructions but not everywhere.

So basically RuboCop::Cop should be replaced by ::RuboCop::Cop. I will try to provide a PR.

@abrisse abrisse added bug Something isn't working vscode This pull request should be included in the VS Code extension's release notes labels Jan 10, 2025
abrisse added a commit to PerfectMemory/ruby-lsp that referenced this issue Jan 10, 2025
@vinistock
Copy link
Member

Thank you for the issue and the PR, but I'm not 100% sure that this is all that's needed to fix the conflicts.

I wrote here a bit about the issues that may happen with RuboCop pushing an add-on that conflicts with our internal implementation rubocop/rubocop#13628 (comment).

We will need a bit more coordination to make this transition work smoothly.

@abrisse
Copy link
Contributor Author

abrisse commented Jan 10, 2025

I see I didn't get the big picture. Appreciate the quick feedback thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working vscode This pull request should be included in the VS Code extension's release notes
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants