LoginSignup
2
3

More than 5 years have passed since last update.

Rubocopを使ってみる

Posted at

Rubocopとは

RubocopはRubyのコーディングチェックツールです。

Github
https://github.com/rubocop-hq/rubocop

インストール

$ gem install rubocop

使い方

$ rubocop
ファイルを指定して実行
$ rubocop sample.rb

実行結果の見方

Inspecting 12 files
.CCC..CCC.CC

Offenses:

「.」はエラーなし
「C」はコーディング違反

Rubocopのオプション

ヘルプの表示
$ rubocop --help

ダブルクォーテーションをシングルクォーテーションに変換
$ rubocop --auto-correct

エディタにRubocopを導入する

Atomに導入する
検索欄にrubocopと入力し、「linter-rubocop」をインストールします。

スクリーンショット 2018-06-03 17.08.50.png

2
3
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
2
3