LoginSignup
0
0

More than 3 years have passed since last update.

rubocopの起動をチョッパヤにする

Posted at

概要

rubocop でコードのチェックをしているが、検査が始まるまでにどえらい時間がかかるのでなんとかしたい

原因

ファイルのリストアップに時間がかかっているっぽい。
プロジェクトのファイル数に比例してロード時間が伸びる。

解決策

Exclude に除外するディレクトリを登録
gemとかJSのライブラリのディレクトリを除外する

AllCops:
  Exclude:
    - '.direnv/**/*'
    - '.git/**/*'
    - 'bin/*'
    - 'db/schema.rb'
    - 'config/**/*'
    - 'lib/tasks/**/*'
    - 'log/**/*'
    - 'node_modules/**/*'
    - 'public/**/*'
    - 'tmp/**/*'
    - 'vendor/**/*'

結果

before

$ rubocop  0.18s user 0.09s system 1% cpu 13.618 total

after

$ rubocop  0.18s user 0.09s system 13% cpu 1.939 total

チョッパヤ

おまけ

rubocop_lineup を使うとmasterとの差分ファイルだけrubocopで検査できるぽい
https://github.com/mysterysci/rubocop_lineup

Gemfile
gem 'rubocop_lineup', require: false
$ rubocop -r rubocop_lineup
Running via Spring preloader in process 22592
Inspecting 7 files
.......
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0