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

Handle autocorrect from rubocop -s #455

Closed
pmk1c opened this issue Mar 15, 2019 · 3 comments
Closed

Handle autocorrect from rubocop -s #455

pmk1c opened this issue Mar 15, 2019 · 3 comments

Comments

@pmk1c
Copy link
Contributor

pmk1c commented Mar 15, 2019

Your environment

  • vscode-ruby version: 0.22.3
  • Ruby version: 2.6.0
  • Ruby version manager (if any): asdf
  • VS Code version: 1.32.1
  • Operating System: Linux
  • Using language server? yes

Expected behavior

In a project we have Rubocop configured with --save-auto-correct in .rubocop configuration files. This should not break linting with vscode-ruby.

Actual behavior

When Rubocop is configure to autocorrect by default vscode-ruby errors with Lint: Received invalid JSON from rubocop when linting. The reason is, that rubocop adds the autocorrected version of the file at the end of the JSON output when invoked in stdin Mode.

@wingrunr21
Copy link
Collaborator

This is similar to #447 for standardrb.

I'm not sure if this is something that should be handled. When should I respect the options in the .rubocop file and when should I override them?

I'd also recommend disabling autocorrect runs with the linter integration. As the linter is run by default on every change to the file buffer, it could cause the linter to be a bit slower as it is running a useless autocorrect.

In any case, RuboCop does not provide a command line option that will allow for overriding the autocorrect options. I can fix it by checking the output and figuring out where the end of the JSON occurs but for the same reasons I talked about in #447 I'd rather not.

@pmk1c
Copy link
Contributor Author

pmk1c commented Mar 24, 2019

This sounds very reasonable. Thanks for your answer.

@pmk1c pmk1c closed this as completed Mar 24, 2019
@wingrunr21
Copy link
Collaborator

#461 may help here too

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

2 participants