Skip to content
This repository has been archived by the owner on Jul 31, 2023. It is now read-only.

rubocop 0.48.1 not working (calling rubocop with '-s' option) #136

Closed
neovatar opened this issue Apr 10, 2017 · 3 comments
Closed

rubocop 0.48.1 not working (calling rubocop with '-s' option) #136

neovatar opened this issue Apr 10, 2017 · 3 comments
Assignees
Labels
bug Bug reports

Comments

@neovatar
Copy link

neovatar commented Apr 10, 2017

Your environment

  • vscode-ruby version: 0.10.4 + 0.11.0 (master)
  • Ruby version: 2.4.1p111 (2017-03-22 revision 58053) [x86_64-linux]
  • VS Code version: 1.11.1
  • Operating System: Ubuntu 16.04.2 LTS
  • Hardware (optional): x86_64
  • Rubocop version: 0.48.1

I installed ruby, ruby-debug-ide, ruby-debug-basex19 and rubocop.

Expected behavior

  • configure vscode-ruby to use rubocop
  • save a ruby file with an error
  • vscode-ruby runs rubocop and reports a problem

Actual behavior

  • configure vscode-ruby to use rubocop
  • save a ruby file with an error
  • no error is reported

Steps to reproduce the problem

  • configure vscode-ruby to use rubocop with:
    "ruby.lint": {
        "rubocop": true
    }
  • save a ruby file with an error e.g.:
def hello
  puts "hello"
  • no error is reported

I uninstalled vscode-ruby, cloned vscode-ruby master from github and did run it in debugging mode via vscode.

I got the following error:

Linter error: rubocop SyntaxError: Unexpected end of JSON input
    at RuboCop.processResult (/home/tom/Data/projects/vscode-ruby/lint/lib/linters/RuboCop.js:21:22)
    at ChildProcess.global._exeLinter.spawned.on.e (/home/tom/Data/projects/vscode-ruby/lint/lib/linter.js:76:20)
    at emitTwo (events.js:106:13)
    at ChildProcess.emit (events.js:191:7)
    at Process.global.ChildProcess._handle.onexit (internal/child_process.js:215:12)

Once I removed the "-s" parameter from the rubocop call, the JSON error was gone and the error in my ruby file got reported correctly on save. With "-s" rubocop expects data from STDIN and does not accept a filename of a file to parse. Maybe this is the origin of the JSON input error?

@rebornix rebornix added the bug Bug reports label Apr 17, 2017
@rebornix rebornix self-assigned this Apr 17, 2017
@mmahalwy
Copy link
Contributor

mmahalwy commented Jul 7, 2017

Any fix for this?

@gerrywastaken
Copy link

gerrywastaken commented Jul 22, 2017

@neovatar @mmahalwy It seems like it was an intentional change and -s does support a filename argument:

see:
ae1f03d
and:
rubocop/rubocop#4226 (comment)

I suspect the author of VS code is only testing against the latest version of Rubocop and so upgrading will probably help you out. Things are working for me with version 0.49.1 of Rubocop. Also make sure that the you are loading vscode with the correct environment as it may be picking up on the wrong rubocop if you have more than one version installed on your system.

@wingrunr21
Copy link
Collaborator

Closing for issue cleanup. Apologies if this is still an issue. We are working to improve the core extension experience.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Bug reports
Projects
None yet
Development

No branches or pull requests

5 participants