10
11

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

RuboCop | Style/LineLength

Last updated at Posted at 2014-07-08

RuboCop | Style/LineLength

概要

RuboCopの「Style/LineLength」警告について。

1行あたりの文字数をチェックし、警告を出します。
デフォルトは80文字です。

LineLength

各設定値での検証結果をまとめます。

検証プログラム

line_length.rb

a = '67890123456789012345678901234567890123456789012345678901234567890123456789'
b = '678901234567890123456789012345678901234567890123456789012345678901234567890'
print a, b

実行結果 デフォルト の場合

.rubocop.yml

LineLength:
  Max: 80
$ rubocop line_length.rb
Inspecting 1 file
C

Offenses:

line_length.rb:2:81: C: Line is too long. [81/80]
b = '678901234567890123456789012345678901234567890123456789012345678901234567890'
                                                                                ^

1 file inspected, 1 offense detected

実行結果 81文字に設定します

.rubocop.yml

LineLength:
  Max: 81
$ rubocop line_length.rb
Inspecting 1 file
.

1 file inspected, no offenses detected

RuboCopまとめ記事

10
11
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
10
11

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?