fnando / vscode-linter

Extension for code linting, all in one package. New linters can be easily added through an extension framework.
https://marketplace.visualstudio.com/items?itemName=fnando.linter
MIT License
63 stars 16 forks source link

Disable linter #2

Closed asbjornu closed 10 months ago

asbjornu commented 3 years ago

In the documentation it says I can disable linters as such:

{
  "linter.linters": {
    "ruby": {
      "enabled": false
    }
  }
}

I've tried adding the above to VSCode's settings.json, but that didn't have any effect. Where and how is Linter supposed to be configured?

fnando commented 3 years ago

Yeah, that's the right place. Maybe you need to restart VSCode? I think results are being cached, but I didn't update the documentation to mention that. Sorry!

asbjornu commented 3 years ago

I've both restarted and updated VSCode and disabled and enabled the extension without any luck. I want to disable Ruby linting because it's not respecting the settings of .rubocop.yml (in particular its Exclude section). If the Ruby linter respected .rubocop.yml configuration, I wouldn't need to disable it.

fnando commented 3 years ago

The ruby linter is just running the ruby interpreter. It doesn't support any kind of configuration.

cat samples/file.rb | ruby -wc
-:7: warning: assigned but unused variable - b
-:5: warning: assigned but unused variable - a
Syntax OK

These are my VSCode settings. As you can see in the screenshot below, it's respecting my settings and not showing any ruby or reek warnings.

CleanShot 2021-07-23 at 13 16 57@2x

Here's the same file, but with linters enabled.

CleanShot 2021-07-23 at 13 17 50@2x

I hope that helps!

asbjornu commented 3 years ago

Weird. This is what I see when I enable Linter:

Block has too many lines

As you can see, this error comes from RuboCop. Disabling Linter makes this error go away. But IIRC, Linter does not support RuboCop so this error does can't come from Linter? 🤔

jtmkrueger commented 10 months ago

@asbjornu

As you can see, this error comes from RuboCop. Disabling Linter makes this error go away. But IIRC, Linter does not support RuboCop so this error does can't come from Linter? 🤔

It does support rubocop. You need to add

    "linter.linters": {
      "ruby": {
        "enabled": false
      },
      "rubocop": {
        "enabled": false
      }
    },

to disable both of them

asbjornu commented 10 months ago

@jtmkrueger, setting the suggested rubocop section in settings.json and restarting VS Code indeed seems to have turned off RuboCop linting. Thanks!