.rubocop.yml
---
require:
- rubocop-rspec
AllCops:
DisplayCopNames: true
DisplayStyleGuide: true
Include:
- "**/Rakefile"
- "**/config.ru"
- "**/*.rb"
TargetRubyVersion: 3.1
NewCops: enable
# Bug in rubocop-rspec config merge: https://github.com/rubocop/rubocop-rspec/pull/1163
RSpec:
Language:
ExampleGroups:
Regular:
# rswag example group aliases
- path
- get
- push
- post
- delete
- stepwise
Examples:
Regular:
# custom dsl for permissions tests
- the_users
- the_user
- step
# Customized options
Lint/DeprecatedOpenSSLConstant:
Enabled: true
Lint/MixedRegexpCaptureTypes:
Enabled: true
Lint/RaiseException:
Enabled: true
Lint/StructNewOverride:
Enabled: true
Layout/LineLength:
Max: 120
Layout/EmptyLinesAroundAttributeAccessor:
Enabled: true
Layout/EndOfLine:
EnforcedStyle: lf
Layout/FirstArrayElementIndentation:
EnforcedStyle: consistent
Layout/FirstHashElementIndentation:
EnforcedStyle: consistent
# We sometimes leave commented out code in the code base
Layout/LeadingCommentSpace:
Enabled: false
Layout/ArgumentAlignment:
EnforcedStyle: with_fixed_indentation
Metrics/ClassLength:
Max: 300
Metrics/CyclomaticComplexity:
Max: 10
Layout/SpaceAroundMethodCallOperator:
Enabled: true
Metrics/BlockLength:
AllowedMethods:
- resource
- describe
- example_group
- shared_examples_for
- shared_examples
- shared_context
- context
- it
- group
- namespace
- task
- draw
- setup
- configure
- draw
- define
- factory
- path
- Async
- aasm
- stepwise
Metrics/MethodLength:
Max: 30
AllowedMethods:
- filter_settings
Metrics/ModuleLength:
Max: 150
Metrics/AbcSize:
Max: 60
# https://github.com/rubocop/rubocop-rspec/issues/795
RSpec/DescribedClass:
EnforcedStyle: explicit
RSpec/ExampleLength:
Max: 200
RSpec/ExpectInHook:
# https://github.com/rubocop/rubocop-rspec/pull/445
Enabled: false
RSpec/ImplicitSubject:
EnforcedStyle: single_statement_only
RSpec/MultipleExpectations:
Max: 6
RSpec/NestedGroups:
Max: 4
RSpec/MultipleMemoizedHelpers:
Max: 10
RSpec/VariableName:
IgnoredPatterns:
# Variable named after http header required by rswag
- ^Authorization$
RSpec/NamedSubject:
# referring to subject explicitly is referring to a named variable - named subject
# I disagree with this style rule.
Enabled: false
Style/AsciiComments:
# emoji are useful
Enabled: false
Style/BlockDelimiters:
EnforcedStyle: semantic
AllowBracesOnProceduralOneLiners: true
AllowedMethods:
- its
- it
Style/ExponentialNotation:
Enabled: true
EnforcedStyle: scientific
Style/HashEachMethods:
Enabled: true
AutoCorrect: false
Style/HashTransformKeys:
Enabled: true
AutoCorrect: false
Style/HashTransformValues:
Enabled: true
AutoCorrect: false
Style/RedundantRegexpCharacterClass:
Enabled: true
Style/RedundantRegexpEscape:
Enabled: true
Style/SlicingWithRange:
Enabled: true
Style/SymbolArray:
EnforcedStyle: brackets
Style/WordArray:
EnforcedStyle: brackets