inherit_from: .rubocop_todo.yml

require: 
  - rubocop-rspec
  - rubocop-performance

AllCops:
  TargetRubyVersion: 2.7
  Exclude:
    - "vendor/**/*"
    - "bin/**/*"
  CacheRootDirectory: tmp
  NewCops: enable

Gemspec/RequireMFA:
  Enabled: false

Layout/SpaceAroundMethodCallOperator:
  Enabled: true
Layout/EmptyLinesAroundAttributeAccessor:
  Enabled: true
Layout/SpaceInsideBlockBraces:
  # The space here provides no real gain in readability while consuming
  # horizontal space that could be used for a better parameter name.
  # Also {| differentiates better from a hash than { | does.
  SpaceBeforeBlockParameters: false
Layout/SpaceInsideHashLiteralBraces:
  EnforcedStyle: no_space
Layout/DotPosition:
  Description: Checks the position of the dot in multi-line method calls.
  StyleGuide: https://github.com/bbatsov/ruby-style-guide#consistent-multi-line-chains
  Enabled: true
  EnforcedStyle: leading
  SupportedStyles:
  - leading
  - trailing
Layout/LineLength:
  Max: 110

Lint/DeprecatedOpenSSLConstant:
  Enabled: true
Lint/MixedRegexpCaptureTypes:
  Enabled: true
Lint/RaiseException:
  Enabled: true
Lint/StructNewOverride:
  Enabled: true

Metrics/ClassLength:
  Exclude:
    - app/controllers/orders_controller.rb
    - app/models/order.rb
    - spec/support/fake_api.rb
Metrics/BlockLength:
  AllowedMethods: ['describe', 'context']
  Exclude:
    - config/environments/**/**
    - Guardfile
    - config/routes.rb
    - config/Guardfile

Naming/PredicateName:
  Description: Check the names of predicate methods.
  StyleGuide: https://github.com/bbatsov/ruby-style-guide#bool-methods-qmark
  Enabled: true
  NamePrefix:
  - is_
  - has_
  - have_
  ForbiddenPrefixes:
  - is_
  Exclude:
  - spec/**/*

RSpec/FilePath:
  Enabled: false
Gemspec/RequiredRubyVersion:
  Enabled: false
    
Style/RedundantRegexpCharacterClass:
  Enabled: true
Style/RedundantRegexpEscape:
  Enabled: true
Style/CollectionMethods:
  Description: Preferred collection methods.
  StyleGuide: https://github.com/bbatsov/ruby-style-guide#map-find-select-reduce-size
  Enabled: true
  PreferredMethods:
    collect: map
    collect!: map!
    find: detect
    find_all: select
    reduce: inject
Style/GuardClause:
  Description: Check for conditionals that can be replaced with guard clauses
  StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-nested-conditionals
  Enabled: true
  MinBodyLength: 1
Style/OptionHash:
  Description: Don't use option hashes when you can use keyword arguments.
  Enabled: false
Style/PercentLiteralDelimiters:
  Description: Use `%`-literal delimiters consistently
  StyleGuide: https://github.com/bbatsov/ruby-style-guide#percent-literal-braces
  Enabled: false
  PreferredDelimiters:
    "%": "()"
    "%i": "()"
    "%q": "()"
    "%Q": "()"
    "%r": "{}"
    "%s": "()"
    "%w": "()"
    "%W": "()"
    "%x": "()"
Style/SignalException:
  Description: Checks for proper usage of fail and raise.
  StyleGuide: https://github.com/bbatsov/ruby-style-guide#fail-method
  Enabled: true
  EnforcedStyle: semantic
  SupportedStyles:
  - only_raise
  - only_fail
  - semantic
Style/StringLiterals:
  Description: Checks if uses of quotes match the configured preference.
  StyleGuide: https://github.com/bbatsov/ruby-style-guide#consistent-string-literals
  Enabled: true
  EnforcedStyle: single_quotes
  SupportedStyles:
  - single_quotes
  - double_quotes
Style/StringLiteralsInInterpolation:
  Description: Checks if uses of quotes inside expressions in interpolated strings
    match the configured preference.
  Enabled: true
  EnforcedStyle: single_quotes
  SupportedStyles:
  - single_quotes
  - double_quotes
Style/Documentation:
  Description: Document classes and non-namespace modules.
  Enabled: false
Style/OneLineConditional:
  Description: Favor the ternary operator(?:) over if/then/else/end constructs.
  StyleGuide: https://github.com/bbatsov/ruby-style-guide#ternary-operator
  Enabled: false
Style/OptionalBooleanParameter:
  Enabled: false

RSpec/NestedGroups:
  Max: 5
RSpec/DescribeClass:
  Exclude:
    - spec/system/*
    - spec/factories_spec.rb