# This is the default configuration file. Enabling and disabling is configured
# in separate files. This file adds all other parameters apart from Enabled.

inherit_from:
  - enabled.yml
  - disabled.yml

# Common configuration.
AllCops:
  # Include gemspec and Rakefile
  Includes:
    - '**/*.gemspec'
    - '**/Rakefile'
  Excludes: []

LineLength:
  Description: 'Limit lines to 79 characters.'
  Max: 79

MethodLength:
  Description: 'Avoid methods longer than 10 lines of code.'
  CountComments: false  # count full line comments?
  Max: 10

ParameterLists:
  Description: 'Avoid parameter lists longer than five parameters.'
  Max: 5
  CountKeywordArgs: true

Semicolon:
  Description: "Don't use semicolons to terminate expressions."
  # For example; def area(height, width); height * width end
  AllowAfterParameterListInOneLineMethods: false
  # For example; def area(height, width) height * width; end
  AllowBeforeEndInOneLineMethods: true

SingleLineMethods:
  Description: 'Avoid single-line methods.'
  AllowIfMethodIsEmpty: true

SpaceInsideHashLiteralBraces:
  Description: "Use spaces inside hash literal braces - or don't."
  EnforcedStyleIsWithSpaces: true

SymbolName:
  Description: 'Symbol literals should use snake_case.'
  AllowCamelCase: true

BlockNesting:
  Description: 'Avoid more than `Max` levels of nesting.'
  Max: 3

NumericLiterals:
  MinDigits: 5

RegexpLiteral:
  Description: >
                 Use %r for regular expressions matching more than
                 `MaxSlashes` '/' characters.
                 Use %r only for regular expressions matching more than
                 `MaxSlashes` '/' character.
  MaxSlashes: 1

# Built-in global variables are allowed by default.
GlobalVars:
  AllowedVariables: []

# Align with the style guide.
CollectionMethods:
  PreferredMethods:
    collect: 'map'
    collect!: 'map!'
    inject: 'reduce'
    detect: 'find'
    find_all: 'select'

# Multi-line method chaining should be done with leading dots.
DotPosition:
  Style: 'leading'

# TrivialAccessors doesn't require exact name matches and doesn't allow
# predicated methods by default.
TrivialAccessors:
  ExactNameMatch: false
  AllowPredicates: false
  Whitelist:
    - to_ary
    - to_a
    - to_c
    - to_enum
    - to_h
    - to_hash
    - to_i
    - to_int
    - to_io
    - to_open
    - to_path
    - to_proc
    - to_r
    - to_regexp
    - to_str
    - to_s
    - to_sym

# Allow safe assignment in conditions.
AssignmentInCondition:
  AllowSafeAssignment: true

# Allow safe assignment in conditions.
ParenthesesAroundCondition:
  AllowSafeAssignment: true

# Checks formatting of special comments
CommentAnnotation:
  Keywords:
    - TODO
    - FIXME
    - OPTIMIZE
    - HACK
    - REVIEW

# Use empty lines between defs.
EmptyLineBetweenDefs:
  # If true, this parameter means that single line method definitions don't
  # need an empty line between them.
  AllowAdjacentOneLineDefs: false

# Align the elements of a hash literal if they span more than one line.
AlignHash:
  # Alignment of entries using hash rocket as separator. Valid values are:
  #
  # key - left alignment of keys
  #   'a' => 2
  #   'bb' => 3
  # separator - alignment of hash rockets, keys are right aligned
  #    'a' => 2
  #   'bb' => 3
  # table - left alignment of keys, hash rockets, and values
  #   'a'  => 2
  #   'bb' => 3
  EnforcedHashRocketStyle: key
  # Alignment of entries using colon as separator. Valid values are:
  #
  # key - left alignment of keys
  #   a: 0
  #   bb: 1
  # separator - alignment of colons, keys are right aligned
  #    a: 0
  #   bb: 1
  # table - left alignment of keys and values
  #   a:  0
  #   bb: 1
  EnforcedColonStyle: key