standardrb / standard

Ruby's bikeshed-proof linter and formatter 🚲
Other
2.69k stars 209 forks source link

ruby-lsp fails to start after 1.37.0 #637

Open bobmaerten opened 3 months ago

bobmaerten commented 3 months ago

Hello there. 👋🏻

I have trouble running ruby-lsp from VSCode with a somehow tweaked rubocop config. I'm including Standard base.yml file as and inherited_gem.

Here the start of my .rubocop.yml file:

inherit_gem:
  standard: config/base.yml

require:
  - rubocop-capybara
  - rubocop-factory_bot
  - rubocop-md
  - rubocop-migration
  - rubocop-minitest
  - rubocop-performance
  - rubocop-rails
  - rubocop-rails-accessibility
  - rubocop-rake
  - rubocop-thread_safety
And the error output of ruby-lsp ``` 2024-06-28 09:49:10.972 [info] (hcs) Ruby LSP Rails booting server 2024-06-28 09:49:10.972 [info] (hcs) /Users/bob/.asdf/installs/ruby/3.3.3/lib/ruby/gems/3.3.0/gems/rubocop-1.64.1/lib/rubocop/config_loader.rb:205:in `absolute_path': no implicit conversion of nil into String (TypeError) File.absolute_path(file.is_a?(RemoteConfig) ? file.file : file) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ from /Users/bob/.asdf/installs/ruby/3.3.3/lib/ruby/gems/3.3.0/gems/rubocop-1.64.1/lib/rubocop/config_loader.rb:205:in `file_path' from /Users/bob/.asdf/installs/ruby/3.3.3/lib/ruby/gems/3.3.0/gems/rubocop-1.64.1/lib/rubocop/config_loader.rb:48:in `load_file' from /Users/bob/.asdf/installs/ruby/3.3.3/lib/ruby/gems/3.3.0/gems/standard-1.39.0/lib/standard/plugin/merges_plugins_into_rubocop_config.rb:60:in `config_for_plugin' from /Users/bob/.asdf/installs/ruby/3.3.3/lib/ruby/gems/3.3.0/gems/standard-1.39.0/lib/standard/plugin/merges_plugins_into_rubocop_config.rb:42:in `block (2 levels) in combine_rubocop_configs' from /Users/bob/.asdf/installs/ruby/3.3.3/lib/ruby/gems/3.3.0/gems/standard-1.39.0/lib/standard/plugin/merges_plugins_into_rubocop_config.rb:40:in `each' from /Users/bob/.asdf/installs/ruby/3.3.3/lib/ruby/gems/3.3.0/gems/standard-1.39.0/lib/standard/plugin/merges_plugins_into_rubocop_config.rb:40:in `reduce' from /Users/bob/.asdf/installs/ruby/3.3.3/lib/ruby/gems/3.3.0/gems/standard-1.39.0/lib/standard/plugin/merges_plugins_into_rubocop_config.rb:40:in `block in combine_rubocop_configs' from /Users/bob/.asdf/installs/ruby/3.3.3/lib/ruby/gems/3.3.0/gems/standard-1.39.0/lib/standard/plugin/merges_plugins_into_rubocop_config.rb:137:in `fake_out_rubocop_default_configuration' from /Users/bob/.asdf/installs/ruby/3.3.3/lib/ruby/gems/3.3.0/gems/standard-1.39.0/lib/standard/plugin/merges_plugins_into_rubocop_config.rb:39:in `combine_rubocop_configs' from /Users/bob/.asdf/installs/ruby/3.3.3/lib/ruby/gems/3.3.0/gems/standard-1.39.0/lib/standard/plugin/merges_plugins_into_rubocop_config.rb:30:in `call' from /Users/bob/.asdf/installs/ruby/3.3.3/lib/ruby/gems/3.3.0/gems/standard-1.39.0/lib/standard/creates_config_store/merges_user_config_extensions.rb:34:in `call' from /Users/bob/.asdf/installs/ruby/3.3.3/lib/ruby/gems/3.3.0/gems/standard-1.39.0/lib/standard/creates_config_store.rb:23:in `block in call' from :90:in `tap' from /Users/bob/.asdf/installs/ruby/3.3.3/lib/ruby/gems/3.3.0/gems/standard-1.39.0/lib/standard/creates_config_store.rb:19:in `call' from /Users/bob/.asdf/installs/ruby/3.3.3/lib/ruby/gems/3.3.0/gems/standard-1.39.0/lib/standard/builds_config.rb:32:in `call' from /Users/bob/.asdf/installs/ruby/3.3.3/lib/ruby/gems/3.3.0/gems/standard-1.39.0/lib/ruby_lsp/standard/wraps_built_in_lsp_standardizer.rb:11:in `init!' from /Users/bob/.asdf/installs/ruby/3.3.3/lib/ruby/gems/3.3.0/gems/standard-1.39.0/lib/ruby_lsp/standard/wraps_built_in_lsp_standardizer.rb:6:in `initialize' from /Users/bob/.asdf/installs/ruby/3.3.3/lib/ruby/gems/3.3.0/gems/standard-1.39.0/lib/ruby_lsp/standard/addon.rb:15:in `new' from /Users/bob/.asdf/installs/ruby/3.3.3/lib/ruby/gems/3.3.0/gems/standard-1.39.0/lib/ruby_lsp/standard/addon.rb:15:in `activate' from /Users/bob/.asdf/installs/ruby/3.3.3/lib/ruby/gems/3.3.0/gems/ruby-lsp-0.17.4/lib/ruby_lsp/addon.rb:70:in `block in load_addons' from /Users/bob/.asdf/installs/ruby/3.3.3/lib/ruby/gems/3.3.0/gems/ruby-lsp-0.17.4/lib/ruby_lsp/addon.rb:69:in `each' from /Users/bob/.asdf/installs/ruby/3.3.3/lib/ruby/gems/3.3.0/gems/ruby-lsp-0.17.4/lib/ruby_lsp/addon.rb:69:in `load_addons' from /Users/bob/.asdf/installs/ruby/3.3.3/lib/ruby/gems/3.3.0/gems/sorbet-runtime-0.5.11435/lib/types/private/methods/_methods.rb:279:in `bind_call' from /Users/bob/.asdf/installs/ruby/3.3.3/lib/ruby/gems/3.3.0/gems/sorbet-runtime-0.5.11435/lib/types/private/methods/_methods.rb:279:in `block in _on_method_added' from /Users/bob/.asdf/installs/ruby/3.3.3/lib/ruby/gems/3.3.0/gems/ruby-lsp-0.17.4/lib/ruby_lsp/server.rb:109:in `load_addons' from /Users/bob/.asdf/installs/ruby/3.3.3/lib/ruby/gems/3.3.0/gems/sorbet-runtime-0.5.11435/lib/types/private/methods/_methods.rb:279:in `bind_call' from /Users/bob/.asdf/installs/ruby/3.3.3/lib/ruby/gems/3.3.0/gems/sorbet-runtime-0.5.11435/lib/types/private/methods/_methods.rb:279:in `block in _on_method_added' from /Users/bob/.asdf/installs/ruby/3.3.3/lib/ruby/gems/3.3.0/gems/ruby-lsp-0.17.4/lib/ruby_lsp/server.rb:243:in `run_initialized' from /Users/bob/.asdf/installs/ruby/3.3.3/lib/ruby/gems/3.3.0/gems/sorbet-runtime-0.5.11435/lib/types/private/methods/_methods.rb:279:in `bind_call' from /Users/bob/.asdf/installs/ruby/3.3.3/lib/ruby/gems/3.3.0/gems/sorbet-runtime-0.5.11435/lib/types/private/methods/_methods.rb:279:in `block in _on_method_added' from /Users/bob/.asdf/installs/ruby/3.3.3/lib/ruby/gems/3.3.0/gems/ruby-lsp-0.17.4/lib/ruby_lsp/server.rb:26:in `process_message' from /Users/bob/.asdf/installs/ruby/3.3.3/lib/ruby/gems/3.3.0/gems/ruby-lsp-0.17.4/lib/ruby_lsp/base_server.rb:66:in `block in start' from /Users/bob/.asdf/installs/ruby/3.3.3/lib/ruby/gems/3.3.0/gems/language_server-protocol-3.17.0.3/lib/language_server/protocol/transport/io/reader.rb:20:in `read' from /Users/bob/.asdf/installs/ruby/3.3.3/lib/ruby/gems/3.3.0/gems/ruby-lsp-0.17.4/lib/ruby_lsp/base_server.rb:39:in `start' from /Users/bob/.asdf/installs/ruby/3.3.3/lib/ruby/gems/3.3.0/gems/sorbet-runtime-0.5.11435/lib/types/private/methods/_methods.rb:279:in `bind_call' from /Users/bob/.asdf/installs/ruby/3.3.3/lib/ruby/gems/3.3.0/gems/sorbet-runtime-0.5.11435/lib/types/private/methods/_methods.rb:279:in `block in _on_method_added' from /Users/bob/.asdf/installs/ruby/3.3.3/lib/ruby/gems/3.3.0/gems/ruby-lsp-0.17.4/exe/ruby-lsp:110:in `' from /Users/bob/.asdf/installs/ruby/3.3.3/bin/ruby-lsp:25:in `load' from /Users/bob/.asdf/installs/ruby/3.3.3/bin/ruby-lsp:25:in `' from /Users/bob/.asdf/installs/ruby/3.3.3/lib/ruby/gems/3.3.0/gems/bundler-2.5.14/lib/bundler/cli/exec.rb:58:in `load' from /Users/bob/.asdf/installs/ruby/3.3.3/lib/ruby/gems/3.3.0/gems/bundler-2.5.14/lib/bundler/cli/exec.rb:58:in `kernel_load' from /Users/bob/.asdf/installs/ruby/3.3.3/lib/ruby/gems/3.3.0/gems/bundler-2.5.14/lib/bundler/cli/exec.rb:23:in `run' from /Users/bob/.asdf/installs/ruby/3.3.3/lib/ruby/gems/3.3.0/gems/bundler-2.5.14/lib/bundler/cli.rb:455:in `exec' from /Users/bob/.asdf/installs/ruby/3.3.3/lib/ruby/gems/3.3.0/gems/bundler-2.5.14/lib/bundler/vendor/thor/lib/thor/command.rb:28:in `run' from /Users/bob/.asdf/installs/ruby/3.3.3/lib/ruby/gems/3.3.0/gems/bundler-2.5.14/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command' from /Users/bob/.asdf/installs/ruby/3.3.3/lib/ruby/gems/3.3.0/gems/bundler-2.5.14/lib/bundler/vendor/thor/lib/thor.rb:527:in `dispatch' from /Users/bob/.asdf/installs/ruby/3.3.3/lib/ruby/gems/3.3.0/gems/bundler-2.5.14/lib/bundler/cli.rb:35:in `dispatch' from /Users/bob/.asdf/installs/ruby/3.3.3/lib/ruby/gems/3.3.0/gems/bundler-2.5.14/lib/bundler/vendor/thor/lib/thor/base.rb:584:in `start' from /Users/bob/.asdf/installs/ruby/3.3.3/lib/ruby/gems/3.3.0/gems/bundler-2.5.14/lib/bundler/cli.rb:29:in `start' from /Users/bob/.asdf/installs/ruby/3.3.3/lib/ruby/gems/3.3.0/gems/bundler-2.5.14/exe/bundle:28:in `block in ' from /Users/bob/.asdf/installs/ruby/3.3.3/lib/ruby/gems/3.3.0/gems/bundler-2.5.14/lib/bundler/friendly_errors.rb:117:in `with_friendly_errors' from /Users/bob/.asdf/installs/ruby/3.3.3/lib/ruby/gems/3.3.0/gems/bundler-2.5.14/exe/bundle:20:in `' from /Users/bob/.asdf/installs/ruby/3.3.3/bin/bundle:25:in `load' from /Users/bob/.asdf/installs/ruby/3.3.3/bin/bundle:25:in `
' ```

It seems to be related with changes made by #635 and #636 but I can't pinpoint the source problem. All I can tell is that fixing Standard version to 1.37.0 in my Gemfile fixes the problem ¯\(ツ)

searls commented 3 months ago

Thanks for this report. We don't provide support for importing standard rules this way, so if you or (or someone else affected) would be able to take point on debugging the root cause and providing a PR, we'd be happy to merge it.