Skip to content

Warnings when executing Rubocop from a specified BUNDLE_GEMFILE #183

@murshed-panorama

Description

@murshed-panorama

Overview

I'm using GitHub Codespaces with VS Code and have the Rubocop extension installed in my remote Codespace environment. When I boot up a Codespace and open my first Ruby file, I get the following two notifications:

command BUNDLE_GEMFILE=/workspaces/my-repo/.overcommit/Gemfile bundle exec rubocop returns empty output! please check configuration.
Source: ruby-rubocop

/bin/sh: 1: bundle: not found
Source: ruby-rubocop

In the VS Code Web Console, I see the following Javascript warning at the same time, although I don't know if it is related.

languageConfigurationExtensionPoint.ts:457 [ruby]: language configuration: expected indentationRules.increaseIndentPattern to be a string or an object.

From my devcontainer.json file, I have the following VS Code settings specified:

{
  // Other settings omitted 
  "vscode": {
    "settings": {
      "eslint.workingDirectories": [
        {
          "mode": "auto"
        }
      ],
      "eslint.useESLintClass": true,
      "eslint.validate": [
        "javascript",
        "vue"
      ],
      "files.insertFinalNewline": true,
      "files.trimFinalNewlines": true,
      "files.trimTrailingWhitespace": true,
      "ruby.rubocop.executePath": "BUNDLE_GEMFILE=/workspaces/my-repo/.overcommit/Gemfile bundle exec ",
      "ruby.rubocop.useBundler": true,
      "rubyLsp.rubyVersionManager": {
          "identifier": "auto"
      },
      "rubyLsp.bundleGemfile": "/workspaces/my-repo/.devcontainer/engineering/tools/lsp/Gemfile"
    },
    "extensions": [
      "dbaeumer.vscode-eslint",
      "github.codespaces",
      "github.copilot",
      "github.copilot-chat",
      "hashicorp.terraform",
      "misogi.ruby-rubocop",
      "ms-vscode-remote.remote-containers",
      "ms-azuretools.vscode-docker",
      "shopify.ruby-lsp",
      "vue.volar"
    ]
  }
}

From /workspaces/my-repo, I've tried running the command (below) myself and although it takes a little bit of time, it does eventually start outputting Rubocop violations as expected. I'm wondering if the plugin is timing out waiting for the command to run initially so it sees "empty output".

BUNDLE_GEMFILE=/workspaces/my-repo/.overcommit/Gemfile bundle exec rubocop

Goal

My goal here is to run Rubocop with Bundler, and use a non-standard location for the Gemfile. I do not want to use the default Rubocop that is in the PATH. Is this the correct way to configure this? If it is correct, is there a way to fix this warning?

Setup Info

Click to expand

Visual Studio Version

Version: 1.96.2 (Universal)
Commit: fabdb6a30b49f79a7aba0f2ad9df9b399473380f
Date: 2024-12-19T10:22:47.216Z
Electron: 32.2.6
ElectronBuildId: 10629634
Chromium: 128.0.6613.186
Node.js: 20.18.1
V8: 12.8.374.38-electron.0
OS: Darwin x64 23.6.0

Relevant Extensions

Plugin ID Version
misogi.ruby-rubocop 0.8.6
shopify.ruby-lsp 0.8.16
dbaeumer.vscode-eslint 3.0.10
vue.volar 2.2.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions