Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
1 contributor

Users who have contributed to this file

106 lines (76 sloc) 2.56 KB

Linting

The language server currently supports linting via the following linters:

Additional linter support can be provided but they must conform to the following rules:

  • Input must be provided via stdin
  • Output must be provided via a machine parsable format (ideally json)

Linter support for linters that run over a whole project (eg brakeman) is being investigated (see #512)

Configuration

Configuration for linting is provided under the ruby.lint key.

The global useBundler flag does not apply to linters. This is an outstanding issue and will be corrected later. Each linter allows the option of overriding useBundler.

RuboCop

RuboCop is a Ruby static code analyzer and formatter, based on the community Ruby style guide

Configuration Options

See the RuboCop CLI args for more details on the support configuration options

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

or

"ruby.lint": {
  "rubocop": {
    "command": "rubocop",  // setting this will override automatic detection
    "useBundler": true,
    "lint": true, // enable lint cops
    "only": ["array", "of", "cops", "to", "run"],
    "except": ["array", "of", "cops", "not", "to", "run"],
    "require": ["array", "of", "ruby", "files", "to", "require"],
    "rails": true // requires rubocop-rails gem for RuboCop >= 0.72.0
  }
}

Standard

Standard is the Ruby Style Guide with linter and automatic code fixer

Configuration Options

See the standard docs for more details on these configuration options

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

or

{
  "standard": {
    "command": "standard",  // setting this will override automatic detection
    "useBundler": true,
    "only": ["array", "of", "cops", "to", "run"],
    "except": ["array", "of", "cops", "not", "to", "run"],
    "require": ["array", "of", "ruby", "files", "to, "require"]
  }
}

Reek

Reek is a code smell detector for Ruby

Configuration Options

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

or

"ruby.lint": {
  "reek": {
    "command": "reek",  // setting this will override automatic detection
    "useBundler": true
  }
}
You can’t perform that action at this time.