misogi / vscode-ruby-rubocop

Rubocop extension for Visual Studio Code
https://marketplace.visualstudio.com/items/misogi.ruby-rubocop
MIT License
137 stars 68 forks source link

ENOENT when autocorrect with bundler on MacOS #65

Closed isnogudus closed 6 years ago

isnogudus commented 6 years ago

When autocorrecting a file in a project with bundler the command 'bundle exec rubocop' is not found. Instead of passing the 3 words as first argument to execFileSync, it has to be splitted to ['bundle', 'exec', 'rubocop']. The first is the command an the rest are options. A fix is to change cp.execFileSync(config.command, [tmpFileName, ...getCommandArguments(tmpFileName), '--auto-correct'], { cwd: getCurrentPath(document.fileName) }); to const cmd = config.command.split(/\s+/) cp.execFileSync(cmd.pop(), [...cmd, tmpFileName, ...getCommandArguments(tmpFileName), '--auto-correct'], { cwd: getCurrentPath(document.fileName) } ) in file rubocop.js

Fixed in #66