inherit_from:
  - config/rubocop_enabled.yml

# Common configuration.
AllCops:
  # Include gemspec and Rakefile
  Include:
    - '**/*.gemspec'
    - '**/*.podspec'
    - '**/*.jbuilder'
    - '**/*.rake'
    - '**/*.opal'
    - '**/Gemfile'
    - '**/Rakefile'
    - '**/Capfile'
    - '**/Guardfile'
    - '**/Podfile'
    - '**/Thorfile'
    - '**/Vagrantfile'
    - '**/Berksfile'
    - '**/Cheffile'
    - '**/Vagabondfile'
  Exclude:
    - 'benchmarks/**/*'
    - 'examples/**/*'
    - 'test/**/*'
    - 'vendor/**/*'
  # By default, the rails cops are not run. Override in project or home
  # directory .rubocop.yml files, or by giving the -R/--rails option.
  RunRailsCops: false
  # Cop names are not displayed in offense messages by default. Change behavior
  # by overriding DisplayCopNames, or by giving the -D/--display-cop-names
  # option.
  DisplayCopNames: true
  # Style guide URLs are not displayed in offense messages by default. Change
  # behavior by overriding DisplayStyleGuide, or by giving the
  # -S/--display-style-guide option.
  DisplayStyleGuide: true
  # Additional cops that do not reference a style guide rule may be enabled by
  # default. Change behavior by overriding StyleGuideCopsOnly, or by giving
  # the --only-guide-cops option.
  StyleGuideCopsOnly: false

Style/EmptyLinesAroundBlockBody:
  EnforcedStyle: no_empty_lines

Style/EmptyLinesAroundClassBody:
  EnforcedStyle: empty_lines

Style/EmptyLinesAroundModuleBody:
  EnforcedStyle: empty_lines

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

# `MinBodyLength` defines the number of lines of the a body of an if / unless
# needs to have to trigger this cop
Style/GuardClause:
  MinBodyLength: 1

Style/IfUnlessModifier:
  MaxLineLength: 80

Style/IndentationWidth:
  Width: 2

# Checks the indentation of the first key in a hash literal.
Style/IndentHash:
  # The value `special_inside_parentheses` means that hash literals with braces
  # that have their opening brace on the same line as a surrounding opening
  # round parenthesis, shall have their first key indented relative to the
  # first position inside the parenthesis.
  # The value `consistent` means that the indentation of the first key shall
  # always be relative to the first position of the line where the opening
  # brace is.
  EnforcedStyle: special_inside_parentheses
  SupportedStyles:
    - special_inside_parentheses
    - consistent

Style/MultilineOperationIndentation:
  Enabled: false

Style/ModuleFunction:
  Enabled: false

Style/Next:
  # With `always` all conditions at the end of an iteration needs to be
  # replaced by next - with `skip_modifier_ifs` the modifier if like this one
  # are ignored: [1, 2].each { |a| return 'yes' if a == 1 }
  EnforcedStyle: skip_modifier_ifs
  # `MinBodyLength` defines the number of lines of the a body of an if / unless
  # needs to have to trigger this cop
  MinBodyLength: 3
  SupportedStyles:
    - skip_modifier_ifs
    - always

Style/RescueModifier:
  Enabled: false

Style/SpaceAroundOperators:
  Enabled: false

Style/SpaceAroundEqualsInParameterDefault:
  EnforcedStyle: space

Style/SpaceBeforeBlockBraces:
  EnforcedStyle: space

Style/SpaceInsideBlockBraces:
  EnforcedStyle: space

Style/SpaceInsideHashLiteralBraces:
  EnforcedStyle: space

Style/TrailingBlankLines:
  EnforcedStyle: final_newline

Style/TrailingComma:
  EnforcedStyleForMultiline: comma

Metrics/AbcSize:
  # The ABC size is a calculated magnitude, so this number can be a Fixnum or
  # a Float.
  Max: 25

Metrics/BlockNesting:
  Max: 3

# Avoid complex methods.
Metrics/CyclomaticComplexity:
  Max: 12

Metrics/MethodLength:
  CountComments: false  # count full line comments?
  Max: 30

Metrics/PerceivedComplexity:
  Max: 10