.rubocop.yml
# Common configuration.
AllCops:
NewCops: enable
RubyInterpreters:
- ruby
- rake
DisplayStyleGuide: true
ExtraDetails: true
TargetRubyVersion: 2.4
Exclude:
- 'vendor/**/*'
- 'bin/**/*'
SuggestExtensions: false
# and/&& or/|| should not be replaced!
# http://www.virtuouscode.com/2010/08/02/using-and-and-or-in-ruby/
Style/AndOr:
EnforcedStyle: conditionals
# Modern screens can easily display more than 80 characters.
Metrics/LineLength:
Max: 250
Metrics/BlockLength:
Exclude:
- '**/*.gemspec'
- 'spec/**/*_spec.rb'
# FrozenStringLiteralComment for Ruby 3 upgrade
Style/FrozenStringLiteralComment:
Enabled: true
# Conditional assignments make the code unreadable sometimes.
Style/ConditionalAssignment:
Enabled: false
# Check with yard instead.
Style/Documentation:
Enabled: false
# Consistent hash indentation
Layout/FirstHashElementIndentation:
EnforcedStyle: consistent
# Consistent array indentation
Layout/FirstArrayElementIndentation:
EnforcedStyle: consistent
# Fail is an alias of raise. Avoid aliases, it's more cognitive load for no gain.
# The argument that fail should be used to abort the program is wrong too,
# there's Kernel#abort for that.
Style/SignalException:
EnforcedStyle: only_raise
# Symbol Arrays cop enabled (drops support for Ruby 1.9)
Style/SymbolArray:
Enabled: true
# Mixing the styles looks just silly
Style/HashSyntax:
EnforcedStyle: ruby19_no_mixed_keys
# has_key? and has_value? are far more readable than key? and value?
Style/PreferredHashMethods:
Enabled: false
# Align hashes like a table
Layout/HashAlignment:
EnforcedColonStyle: table
EnforcedHashRocketStyle: table
# Align arguments with the same indentation level
Layout/ArgumentAlignment:
EnforcedStyle: with_fixed_indentation