-
Notifications
You must be signed in to change notification settings - Fork 286
Long RuboCop/Standard output JSON does not parse correctly #435
Comments
Plugin configuration:
|
Can you post your configuration? Great thanks! |
@wingrunr21 see above |
If you remove the Ruby lint entry does the error resolve? It’s redundant with rubocop and I’m not supporting it in the language server. |
@wingrunr21 yes. Error have disappeared. But have next message in logs and I don't see lint errors:
Is it because of old rubocop version (0.57.2)? I can't use more modern rubocop because this version is last which supports ruby 2.1 |
nevermind. Look like it's an issue with asdf which I use as ruby version manager |
Ah, mind telling me what the issue is? I'd like to support that if I can |
@wingrunr21 rubocop is run via asdf as a shim. Asdf determine which ruby version to use based on the current working directory and |
Is the How does asdf expose which ruby to run? Does it modify the environment? |
I made some debugging. Looks like when rubocop is called no environment variable are set. asdf depends on In a normal environment, this variable (with other configs) is set via a special script which is called from |
Could you provide the ability to set custom environment variables for linters? I believe it will also allow to fix any issues with running rubocop with rvm too. |
The environment variables need to be whitelisted into the environment detection |
|
I've updated to 0.22.1 and still don't see any value for HOME variable within asdf scripts. I've tried to output
Not sure why this happens. I don't even see |
Looks like something is wrong with setting env variable. When I output |
Ok, your original issue of Would you mind giving that version another try for your RuboCop linting? I made some additional changes to the environment detection. If that doesn't work, are you using a shell that's different from your user's default shell? |
@wingrunr21 now rubocop run successfully but I have a error about invalid json. But output json seems legit to me.
If I add settings to enable only lint and rails: {
"ruby.lint": {
"rubocop": {
"lint": true,
"rails": true,
}
},
"ruby.useLanguageServer": true,
} then I don't have any errors and see rubocop errors in vscode but only a few (2 instead 55 like in json above). Look like not all rules are applied. |
I've outputted error on JSON parse (BTW, I think it will be useful for debugging to show it by default but not only "Lint: Received invalid JSON from rubocop") and get next errors:
Looks like a rubocop output is split into several chunks and is not later combined in one whole. |
fwiw, I'm seeing the same error as above ^.
vscode-ruby: 0.22.2 It will lint as expected on files with only a few offenses, but when there are many, it throws this error. |
Ya, I've traced this to |
v0.22.3 has the bugfix for this |
@wingrunr21 now everything works as expected. Thank you a lot! |
Great! Thanks for all your help and patience working through these bugs! |
Your environment
vscode-ruby
version: 0.22.0Expected behavior
Rubocop will lint a file
Actual behavior
Rubocop doesn't lint a file. And I have next error in Ruby language server output:
And this message appears several times
The text was updated successfully, but these errors were encountered: