Closed4

ruby-lspでrubocopを使いたい。でも、プロジェクトのGemfileは汚したくない時

shin039shin039

VS Codeでの利用を想定している。
ちょっと試行錯誤したので、メモを残しておく。

rubyはパスが通っていてどこでも実行できる前提。

拡張機能の概要 の、Using a custom Gemfile を設定すればOK。

shin039shin039

どこか適当な場所に、ディレクトリを用意する。

pwd /Users/foo
mkdir ruby-lsp

Gemfileを生成する

touch Gemfile

Gemfileに下記を記述する

source "https://rubygems.org"

gem "ruby-lsp"
gem "rubocop"

gem "rubocop-packaging"
gem "rubocop-performance"
gem "rubocop-rspec"
gem "rubocop-shopify"
gem "rubocop-thread_safety"

bundle install実施

bundle install
shin039shin039

ホームディレクトリ配下に、.rubocop.yml ファイルを用意しておけばそれも読み取ってくれる。

このスクラップは4ヶ月前にクローズされました