# This is the configuration used to check the rubocop source code.

inherit_from: .rubocop_todo.yml
require:
  - rubocop/cop/internal_affairs
  - rubocop-performance
  - rubocop-rspec
  - rubocop-rake

AllCops:
  NewCops: enable
  Exclude:
    - 'vendor/**/*'
    - 'spec/fixtures/**/*'
    - 'tmp/**/*'
    - '.git/**/*'
    - 'bin/*'
  TargetRubyVersion: 2.6
  SuggestExtensions: false

Naming/PredicateName:
  # Method define macros for dynamically generated method.
  MethodDefinitionMacros:
    - define_method
    - define_singleton_method
    - def_node_matcher
    - def_node_search

Style/AccessorGrouping:
  Exclude:
    - lib/rubocop/formatter/base_formatter.rb
    - lib/rubocop/cop/offense.rb

Style/FormatStringToken:
  # Because we parse a lot of source codes from strings. Percent arrays
  # look like unannotated format string tokens to this cop.
  Exclude:
    - spec/**/*

Style/IpAddresses:
  # The test for this cop includes strings that would cause offenses
  Exclude:
    - spec/rubocop/cop/style/ip_addresses_spec.rb

Layout/EndOfLine:
  EnforcedStyle: lf

Layout/ClassStructure:
  Enabled: true

Layout/RedundantLineBreak:
  Enabled: true

Layout/TrailingWhitespace:
  AllowInHeredoc: false

Lint/AmbiguousBlockAssociation:
  Exclude:
    - 'spec/**/*.rb'

Layout/HashAlignment:
  EnforcedHashRocketStyle:
    - key
    - table
  EnforcedColonStyle:
    - key
    - table

Layout/LineLength:
  Max: 100
  AllowedPatterns:
    - !ruby/regexp /\A +(it|describe|context|shared_examples|include_examples|it_behaves_like) ["']/

Lint/InterpolationCheck:
  Exclude:
    - 'spec/**/*.rb'

Lint/UselessAccessModifier:
  MethodCreatingMethods:
    - 'def_matcher'
    - 'def_node_matcher'

Metrics/BlockLength:
  Exclude:
    - 'Rakefile'
    - '**/*.rake'
    - 'spec/**/*.rb'
    - '**/*.gemspec'

Metrics/ClassLength:
  Exclude:
    - lib/rubocop/config_obsoletion.rb
    - lib/rubocop/options.rb

Metrics/ModuleLength:
  Exclude:
    - 'spec/**/*.rb'

Naming/InclusiveLanguage:
  Enabled: true
  CheckStrings: true
  FlaggedTerms:
    auto-correct:
      Suggestions:
        - autocorrect
    auto_correct:
      Suggestions:
        - autocorrect
    behaviour:
      Suggestions:
        - behavior
    offence:
      Suggestions:
        - offense
  Exclude:
    - lib/rubocop/cop/naming/inclusive_language.rb
    - lib/rubocop/cop/mixin/auto_corrector.rb
    - spec/rubocop/cop/naming/inclusive_language_spec.rb

RSpec:
  Language:
    Expectations:
      - expect_autocorrect_options_for_autocorrect
      - expect_autocorrect_options_for_autocorrect_all
      - expect_autocorrect_options_for_fix_layout
      - expect_correction
      - expect_feature_loader
      - expect_no_offenses
      - expect_offense

RSpec/FilePath:
  Exclude:
    - spec/rubocop/cop/internal_affairs/redundant_let_rubocop_config_new_spec.rb
    - spec/rubocop/formatter/junit_formatter_spec.rb

RSpec/PredicateMatcher:
  EnforcedStyle: explicit

RSpec/MessageSpies:
  EnforcedStyle: receive

RSpec/NestedGroups:
  Max: 7

RSpec/MultipleMemoizedHelpers:
  Enabled: false

Performance/CollectionLiteralInLoop:
  Exclude:
    - 'Rakefile'
    - 'spec/**/*.rb'

Performance/EndWith:
  SafeMultiline: false

Performance/StartWith:
  SafeMultiline: false

RSpec/StubbedMock:
  Enabled: false

InternalAffairs/ExampleDescription:
  Include:
    - 'spec/rubocop/cop/**/*.rb'

InternalAffairs/ExampleHeredocDelimiter:
  Include:
    - 'spec/rubocop/cop/**/*.rb'

InternalAffairs/UndefinedConfig:
  Include:
    - 'lib/rubocop/cop/**/*.rb'
  Exclude:
    - 'lib/rubocop/cop/correctors/**/*.rb'
    - 'lib/rubocop/cop/mixin/**/*.rb'

InternalAffairs/StyleDetectedApiUse:
  Exclude:
    - 'lib/rubocop/cop/mixin/percent_array.rb'

InternalAffairs/NumblockHandler:
  Exclude:
    - 'lib/rubocop/cop/internal_affairs/*.rb'

Gemspec/DependencyVersion:
  Enabled: true
