Rubocop extension for Visual Studio Code
Branch: master
Clone or download
misogi Merge pull request #84 from misogi/0_7_1
update version to 0.7.1
Latest commit 247ea75 Nov 5, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.vscode Fix tslint config and cleanup code Jul 2, 2017
images update packaging Dec 16, 2015
src Fix autoCorrection find on windows Jul 23, 2018
test Set autocorrect as a formatter Jan 3, 2018
.gitignore Regenerate VSCode extension code from https://github.com/Microsoft/vs… Feb 21, 2017
.travis.yml Configure Travis CI to use default install script, run `npm run vscod… Feb 22, 2017
.vscodeignore Regenerate VSCode extension code from https://github.com/Microsoft/vs… Feb 21, 2017
CHANGELOG.md update version to 0.7.1 Nov 5, 2018
LICENSE.txt this extension is licensed under MIT license now Feb 22, 2017
README.md Fix spelling and grammar Mar 6, 2018
package.json update version to 0.7.1 Nov 5, 2018
tsconfig.json Fix tslint config and cleanup code Jul 2, 2017
tsfmt.json
tslint.json Fix tslint issues Jun 29, 2017
vsc-extension-quickstart.md upgrade environment Nov 4, 2016
yarn.lock update version to 0.7.1 Nov 5, 2018

README.md

Rubocop for Visual Studio Code

travis status

Visual Studio Code でrubocopを実行するエクステンションです。

This extension provides interfaces to rubocop for vscode.

rubocop is code analyzer for ruby.

ruby rubocop in Code Market Place

exec on save

problems

This extension may have a problem when using a rvm or chruby environment. We recommend vscode-ruby. It can also lint ruby code.

When autoCorrect, History of changing file is broken.

features

  • lint by execute command "Ruby: lint by rubocop" (cmd+shift+p and type command)
  • auto invoke when saving file
  • auto correct command "Ruby: autocorrect by rubocop"

Exclude file

An extension forces rubocop's force-exclusion option.

If you want not to execute rubocop on some file, You could add AllCops/Exclude on rubocop.yml. This can saving without executing rubocop.

Installation

Installation of ruby and rubocop is required.

gem install rubocop
  • Type F1 (or Command + Shift + P)
  • execute "Extensions: install extension"
  • type rubocop and execute ext install ruby-rubocop

ChangeLog

ChangeLog

Configuration

Specify configuration (via navigating to File > Preferences > Workspace Settings and editing file settings.json):

{
  // If not specified searches for 'rubocop' executable available on PATH (default and recommended)
  "ruby.rubocop.executePath": "",

  // You can use specific path
  // "ruby.rubocop.executePath": "/Users/you/.rbenv/shims/"
  // "ruby.rubocop.executePath": "/Users/you/.rvm/gems/ruby-2.3.2/bin/"
  // "ruby.rubocop.executePath": "D:/bin/Ruby22-x64/bin/"

  // If not specified, it assumes a null value by default.
  "ruby.rubocop.configFilePath": "/path/to/config/.rubocop.yml",

  // default true
  "ruby.rubocop.onSave": true
}

Keybindings

You can change keybinding (via editing keybindings.json)

{ "key": "ctrl+alt+l",          "command": "ruby.rubocopAutocorrect",
                                "when": "editorLangId == 'ruby'" }

todo

  • more configurable command line option (like -R)
  • integration with rbenv
  • testing & CI support

Contribute with this extension

Please install packages with yarn.

yarn install

You could install TSLint extension for .ts files.

Formatting code using vvakame/typescript-formatter

tsfmt -r src/*

License

このソフトウェアはMITライセンスの元で公開されています。LICENSE.txt をご覧下さい。

This software is released under the MIT License, see LICENSE.txt.