Vscode-ruby: Rubocop settings not working

Created on 27 Jun 2017  路  5Comments  路  Source: rubyide/vscode-ruby

Your environment

  • vscode-ruby version: 0.12.1
  • Ruby version: 2.3.1p112
  • VS Code version: 1.13.1
  • Operating System: OSX
  • Hardware (optional):

Make sure you have ruby, ruby-debug-ide and ruby-debug-basex19 installed before submitting your issue -- thank you !

Rubocop is only working with simple settings:

   "rubocop": true

More complex settings like:

  "rubocop": {
    "lint": true,
    "rails": true
  }

Don't seem to work at all. No linting is happening

question

Most helpful comment

@chrisnicola

Ok just looked through the code to see what was happening... because I dunno... I guess I'm procrastinating...

Anyway so I suspect those settings are not doing what you think they are doing.

It's essentially running rubocop -f json --force-exclusion -l -R. Try running that against your file and see if it produces anything... I suspect it doesn't.

That's because that -l actually limits the set of rubocop checks to this much smaller set:
https://github.com/bbatsov/rubocop/tree/master/lib/rubocop/cop/lint

So I suspect what you actually want is:

"rubocop": {
    "rails": true
 }

And I think maybe the doc should be updated to make it clear what lint: true will do. I suspect to most reading that doc it seems like that's just what you specify if you want to enable Rubocop as that's what I looked like to me until I went diving into the code.

cc: @Vuneu @agamrp @al13bash @javiervidal because you gave the issue a thumbs up, so I'm guessing you ran into the same problem.

All 5 comments

@chrisnicola

Ok just looked through the code to see what was happening... because I dunno... I guess I'm procrastinating...

Anyway so I suspect those settings are not doing what you think they are doing.

It's essentially running rubocop -f json --force-exclusion -l -R. Try running that against your file and see if it produces anything... I suspect it doesn't.

That's because that -l actually limits the set of rubocop checks to this much smaller set:
https://github.com/bbatsov/rubocop/tree/master/lib/rubocop/cop/lint

So I suspect what you actually want is:

"rubocop": {
    "rails": true
 }

And I think maybe the doc should be updated to make it clear what lint: true will do. I suspect to most reading that doc it seems like that's just what you specify if you want to enable Rubocop as that's what I looked like to me until I went diving into the code.

cc: @Vuneu @agamrp @al13bash @javiervidal because you gave the issue a thumbs up, so I'm guessing you ran into the same problem.

I can confirm that:

$ rubocop --force-exclusion -R -l
64 files inspected, 3 offenses detected
$ rubocop --force-exclusion -R
64 files inspected, 414 offenses detected

Thank you @gerrywastaken

Thanks @gerrywastaken I appreciate you taking the time to look into that.

@javiervidal @chrisnicola You are both very welcome. I think the docs should probably be updated to show what this option does.

@gerrywastaken I really appreciate your investigation and all your help here. I'll update the documentation.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

rebornix picture rebornix  路  3Comments

webmastak picture webmastak  路  4Comments

atracy picture atracy  路  3Comments

resistorsoftware picture resistorsoftware  路  3Comments

lalunamel picture lalunamel  路  5Comments