Content last updated 2023-07-18

RuboCop

RuboCopRuby のコードに対して静的コード解析を実行するために使用されます。

“魔法” のワンライナー

一連のファイルを RuboCop する

Git ページ のファイル一覧表示のヒントを RuboCop と組み合わせられます。

  • 現在のコミットを RuboCop する - git diff-tree --no-commit-id --name-only -r HEAD --diff-filter AMT | xargs bundle exec rubocop
  • 作業ツリーの変更を RuboCop する - git diff --name-only --diff-filter AMT | xargs bundle exec rubocop
  • ブランチからのすべての変更を RuboCop する - git diff --name-only master --diff-filter AMT | xargs bundle exec rubocop