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

Multiple linters #524

Closed
e1senh0rn opened this issue Aug 27, 2019 · 3 comments
Closed

Multiple linters #524

e1senh0rn opened this issue Aug 27, 2019 · 3 comments

Comments

@e1senh0rn
Copy link

Your environment

  • vscode-ruby version: 0.24.2
  • Ruby version: 2.6.3
  • Ruby version manager (if any): chruby
  • VS Code version: 1.37.1
  • Operating System: macOS 10.14.6
  • Using language server? yes

Expected behavior

Providing only one linter (reek, rubocop) produces correct violation messages.
Adding two linters (reek, rubocop) should list violations from both of linters.

Actual behavior

Adding single linter produces correct messages.
In multi-linter configuration only one linter works (rubocop).

I can see that reek produces violation messages, and they are displayed in VSCode UI.
A second later rubocop finishes analysis, and results are replaced with rubocop messages.

@wingrunr21
Copy link
Collaborator

Hmm, that's interesting. Code diagnostics should be run in parallel and then flattened before being sent back to the client. I will take a look here.

Do you have an example file I can use to verify? I've got a few I use for development but a specific example would be great if you are willing to share.

@e1senh0rn
Copy link
Author

I actually encountered it with even simplest example.
With reek alone I see complaints:

  • "has the name 'x'" (UncommunicativeMethodName)
  • "has the variable name 'y'" (UncommunicativeVariableName)

With rubocop alone I see complaints:

  • Style/FrozenStringLiteralComment
  • Style/Semicolon

For a moment reek messages appear, but are replaced with ones from rubocop.
screencast 2019-08-27 22-18-16

app.rb

# Install dependencies via:
#   bundle install --path=./.bundle

# Failing rubocop validation
puts 'foo'; puts 'bar'

# Failing reek validation
class Smelly
  def x
    y = 10
    y
  end
end

Gemfile

source 'https://rubygems.org'

gem 'rubocop'
gem 'reek'

And here is my ruby configuration:

  "ruby.lint": {
    "reek": {
      "useBundler": true
    },
    "rubocop": {
      "useBundler": true
    }
  },
  "ruby.format": "rubocop",
  "ruby.useBundler": true,
  "ruby.useLanguageServer": true,
  "[ruby]": {
    "editor.defaultFormatter": "rebornix.ruby"
  }

@e1senh0rn
Copy link
Author

Many thanks! Really appreciate such a quick release!

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