Skip to content

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

@abrisse

Description

@abrisse

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingvscodeThis pull request should be included in the VS Code extension's release notes

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions