bbatsov/rubocop

View on GitHub
.rubocop.yml

Summary

Maintainability
Test Coverage
# 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.7
  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'

Lint/EmptyFile:
  Exclude:
    # This file is intentionally empty to catch rubocop cops failing on empty files.
    - spec/rubocop/intentionally_empty_file.rb

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

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

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

Naming/InclusiveLanguage:
  Enabled: true
  CheckStrings: true
  FlaggedTerms:
    ' a offense':
      Suggestions:
        - an offense
    ' and offense':
      Suggestions:
        - ' an offense'
    auto-correct:
      Suggestions:
        - autocorrect
    auto_correct:
      Suggestions:
        - autocorrect
    behaviour:
      Suggestions:
        - behavior
    offence:
      Suggestions:
        - offense
    'does not registers':
      Suggestions:
        - does not register
    'register no offense':
      Suggestions:
        - registers no offense
    'does not register and corrects':
      Suggestions:
        does not register
    'does not register an offense and corrects':
      Suggestions:
        does not register an 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/PredicateMatcher:
  # Also consider `be(true)` and `be(false)` as offenses, instead of only `be_truthy` and `be_falsy`
  Strict: false

RSpec/SpecFilePathFormat:
  CustomTransform:
    GitHubActionsFormatter: github_actions_formatter
    JUnitFormatter: junit_formatter
    RedundantLetRuboCopConfigNew: redundant_let_rubocop_config_new
  Exclude:
    - spec/rubocop/cop/mixin/enforce_superclass_spec.rb

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

Style/RequireOrder:
  Enabled: true