yujinakayama / atom-lint

Obsolete: Generic code linting support for Atom
https://atom.io/packages/atom-lint
MIT License
111 stars 33 forks source link

RuboCop: "Unexpected end of input" #46

Closed vanhecke closed 10 years ago

vanhecke commented 10 years ago

RuboCop stopped working (it was working before).

On every save I get (using 0.11.3):

SyntaxError: Unexpected end of input
  at Object.parse (native)
  at /Users/joris/.atom/packages/atom-lint/lib/linter/rubocop.coffee:46:31
  at ChildProcess.<anonymous> (/Users/joris/.atom/packages/atom-lint/lib/command-runner.coffee:99:7)
  at ChildProcess.EventEmitter.emit (events.js:104:17)
  at maybeClose (child_process.js:821:16)
  at Socket.<anonymous> (child_process.js:1038:11)
  at Socket.EventEmitter.emit (events.js:101:17)
  at Pipe.close (net.js:459:12)

Atom is loaded with the correct path (shows in status bar)

JeanMerz posted same issue in closed issue: https://github.com/yujinakayama/atom-lint/issues/30#issuecomment-40604625

JeanMertz commented 10 years ago

Yep, I've got the same issue. Are you using any ruby version manager? Not sure if that is causing my issue, but either way it's not working right now.

vanhecke commented 10 years ago

I use rubies-fish & ruby-install, atom is started from terminal with correct $PATH.

JeanMertz commented 10 years ago

@nopc0de using chruby-fish myself.

I just managed to solve this by creating a wrapper script:

#!/usr/local/bin/bash

export HOME=/Users/Jean
source /usr/local/share/chruby/chruby.sh
chruby 2.1
rubocop "$@"

just modify it, and put this in ~/bin/rubocop, then add the following (modified) to your config.cson:

'atom-lint':
  'rubocop':
    'path': '/Users/Jean/bin/rubocop'

I haven't tested this with .rubocop.yml files, but I suspect it should work.

note the brew-installed bash path, if you want to use the system-one, use /bin/bash.

JeanMertz commented 10 years ago

Or an even easier one (since you are also using fish):

#!/usr/bin/env fish
env HOME=/Users/Jean rubocop $argv
yujinakayama commented 10 years ago

Though not sure whether you still have this issue, could you try this with the latest atom-lint 0.14.1 which dumps detailed error information in Developer Console?

yujinakayama commented 10 years ago

Closing this for now. Reopen if you still have an issue.