Vscode-ruby: Unable to disable linter

Created on 13 Sep 2019  路  12Comments  路  Source: rubyide/vscode-ruby

Your environment

  • vscode-ruby version: 0.25.3
  • Ruby version: 2.6.2
  • Ruby version manager (if any): rbenv
  • VS Code version: 1.38.1
  • Operating System: macOS
  • Using language server? (eg useLanguageServer is true?) Yes

Expected behavior

With the following in the user settings.json:

"ruby.lint": {
  "rubocop": true
}

The following in the workspace settings.json should disable RuboCop:

"ruby.lint": {
  "rubocop": false
}

Actual behavior

RuboCop still runs.

Most helpful comment

FWIW I was running into this same issue with the following settings:

    "ruby.useLanguageServer": true,
    "ruby.lint": {
        "rubocop": false,
        "standard": true
    }

When I removed the rubocop line altogether, rubocop stopped being run by the linter.

All 12 comments

Seeing this as well.

Thanks, will investigate

I am wondering if the reason is bc Standard uses Rubocop under the hood. Not sure if that helps at all but that was my first thought. Thanks for everything you do @wingrunr21!

Are these multi-root workspaces or single root?

@wingrunr21 single root for me. I had rubocop set to run in my global settings and standard to run in a workspace settings file. When I saw the behavior mentioned above, I commented out the global rubocop settings, and reloaded, but still saw rubocop attempting to run. I have an example of the behavior if a screenshot would help.

Did you also disable RuboCop in the workspace settings? Otherwise it will still be enabled and technically bundle exec rubocop... will work. That being said, it appears @erbridge has done just this and still sees the issue.

If you are able to throw up an example repo that'd really help. I just need to see what settings get communicated to the server as VSCode is the one that unifies the various settings at different scopes and then sends those to the server. I'm doing work to support machine scoped settings so if this is a bug I want to fix it before I ship that!

@wingrunr21 I disabled rubocop as well. I鈥檒l link you to a repo branch later this evening when I鈥檓 back at my computer.

FWIW I was running into this same issue with the following settings:

    "ruby.useLanguageServer": true,
    "ruby.lint": {
        "rubocop": false,
        "standard": true
    }

When I removed the rubocop line altogether, rubocop stopped being run by the linter.

Yeah. My investigation suggests that the presence of any value for ruby.lint.rubocop in either settings file causes Rubocop to be run.

Also, I've only looked at single root environments.

Yeah. My investigation suggests that the presence of any value for ruby.lint.rubocop in either settings file causes Rubocop to be run.

You're absolutely right. The boolean value in the linter config was basically ignored, causing the linter to always be active, as long as it's name was in the config. I opened a PR to remedy this situation.
With this change, the repository provided by @andrewmcodes also shows the expected behavior.

I will merge that PR when the builds pass

Was this page helpful?
0 / 5 - 0 ratings