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

Received invalid JSON from rubocop #474

Closed
raywagner88 opened this issue Apr 27, 2019 · 6 comments
Closed

Received invalid JSON from rubocop #474

raywagner88 opened this issue Apr 27, 2019 · 6 comments

Comments

@raywagner88
Copy link

Your environment

  • vscode-ruby version: 0.22.3
  • Ruby version: 2.3.8
  • Ruby version manager (if any): rvm
  • VS Code version: 1.33.1
  • Operating System: OSX 10.14.4
  • Using language server? Yes

Expected behavior

Rubocop warning will appear within the problems console.

Actual behavior

Rubocop is returning invalid json.

This and the next section should include screenshots, code samples, console output, etc. The more information we have to reproduce the better!

Rubocop version 0.67.2 returns a warning before the json response [Warn] Performance Cops will be removed from RuboCop 0.68. Use rubocop-performance gem instead. which seems to be breaking the Rubocop abilities within this extension.

@wingrunr21
Copy link
Collaborator

Thanks for the report. Looks like there are a number of issues opened with Rubocop and Atom already. I’ll take a look at their suggestions tomorrow.

@minkir014
Copy link

minkir014 commented May 6, 2019

I think this can be fixed by modifying your code instead of rubocop write rubocop-performance in package.json and other things you tell the extension about rubocop or you can install older versions of rubocop where the cops isn't removed.

@Unknown-Guy
Copy link

Answer to similar issue: rubocop/rubocop#6910 (comment)

@wingrunr21
Copy link
Collaborator

RuboCop is saying to basically ignore anything on stderr. I'd make the argument that they shouldn't be printing non-JSON data to any output when the JSON formatter is specified but looks like they disagree.

I've already fixed this in my local branch. Unfortunately, my local test environment is running into the issue with #470 so that's what I'm poking at now. In the mean time, the solution is to either upgrade or downgrade RuboCop as the warning only existed in 0.67.x

@minkir014
Copy link

Maybe issue #470 isn't related to the extension but to rubocop.

@dennissivia
Copy link

I have a similar issue, currently. The rubocop lint is failing because of a warning that rubocop (the CLI) is creating. All of the mentioned issues have in common, that output to STDERR is created and this results in Lint: Received invalid JSON from rubocop:.
If the command would skip STDERR, the warnings would not be interpreted as JSON and parsing would work as expected. (As mentioned here). This does not solve invalid rubocop installations, but it solves every problem that is based on output to STDOUT (warnings, errors, ...).

@wingrunr21 is it possible to publish your local branch, so that somebody with a working local setup can support you?

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

No branches or pull requests

5 participants