Skip to content

Instantly share code, notes, and snippets.

@TakuyaHarayama
Created September 14, 2017 02:45
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TakuyaHarayama/a9623dbbc53c6b349ac0765d053fccb6 to your computer and use it in GitHub Desktop.
Save TakuyaHarayama/a9623dbbc53c6b349ac0765d053fccb6 to your computer and use it in GitHub Desktop.
Railsのrubocopサンプル
# Railsのチェックを有効にする
Rails:
Enabled: true
# 日本語でのコメントを許可
AsciiComments:
Enabled: false
# モジュール名::クラス名の定義を許可
ClassAndModuleChildren:
Enabled: false
# メソッド名のprefixに「set_」「get_」を許可
AccessorMethodName:
Enabled: false
# 「and」「or」の使用を許可
AndOr:
Enabled: false
# === Style系
# ドキュメント用のコメントは不要
Style/Documentation:
Enabled: false
Style/FrozenStringLiteralComment:
Enabled: false
# hashをメソッドの引数にするときに{}を省略できるけど、書いてもいい設定
Style/BracesAroundHashParameters:
Enabled: false
# returnがなくてもいい場所で書いてもいい設定
Style/RedundantReturn:
Enabled: false
# array.map(&:somemethod)みたいな書き方ができる場所でしなくてもいい設定
Style/SymbolProc:
Enabled: false
# === Lint系
Lint/NonLocalExitFromIterator:
Enabled: false
Lint/UnderscorePrefixedVariableName:
Enabled: false
# Max length in one line
LineLength:
Max: 120
# === Metrics系
Metrics/AbcSize:
Max: 35
Metrics/ClassLength:
Max: 200
Metrics/CyclomaticComplexity:
Max: 9
Metrics/MethodLength:
Max: 35
Metrics/PerceivedComplexity:
Max: 11
# === 共通設定
AllCops:
# target ruby version
TargetRubyVersion: 2.2
Include:
- '**/Rakefile'
- '**/config.ru'
Exclude:
- 'db/**/*'
- 'config/**/*'
- 'tmp/**/*'
- 'bin/*'
- 'script/**/*'
- 'vendor/**/*'
- 'lib/**/*'
- '**/Gemfile'
- !ruby/regexp /old_and_unused\.rb$/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment