.rubocop.yml
inherit_from: .rubocop_todo.yml
inherit_mode:
merge:
- Exclude
- CountAsOne
require:
- rubocop-minitest
- rubocop-packaging
- rubocop-performance
AllCops:
Exclude:
- 'examples/*'
NewCops: enable
TargetRubyVersion: 3.0
# Put development dependencies in the gemspec so rubygems.org knows about them
Gemspec/DevelopmentDependencies:
EnforcedStyle: gemspec
# Make BeginEndAlignment behavior match EndAlignment
Layout/BeginEndAlignment:
EnforcedStyleAlignWith: begin
# Spaces in strings with line continuations go at the beginning of the line.
Layout/LineContinuationLeadingSpace:
EnforcedStyle: leading
# Be lenient with line length
Layout/LineLength:
Max: 92
# Don't force lonely closing parentheses
Layout/MultilineMethodCallBraceLayout:
EnforcedStyle: same_line
# Multi-line method calls should be simply indented. Aligning them makes it
# even harder to keep a sane line length.
Layout/MultilineMethodCallIndentation:
EnforcedStyle: indented
# Force consistent spacing independent of block contents
Layout/SpaceBeforeBlockBraces:
EnforcedStyleForEmptyBraces: space
# Assume the programmer knows how bracketed block syntax works
Lint/AmbiguousBlockAssociation:
Enabled: false
# Assume the programmer knows precendence rules
Lint/AmbiguousOperatorPrecedence:
Enabled: false
# Allow if (foo = get_foo) style
Lint/AssignmentInCondition:
AllowSafeAssignment: true
# Test describe blocks, rake task namespaces, and gem specification blocks can be any size
Metrics/BlockLength:
Exclude:
- 'test/**/*'
- 'tasks/*.rake'
- '*.gemspec'
# Count certain literals as only one line of code
Metrics/MethodLength:
CountAsOne:
- heredoc
# Allow semantic variation in and/or external determination of symbols
Naming/VariableNumber:
CheckSymbols: false
Performance/StartWith:
AutoCorrect: true
# Use alias_method since it is more versatile
Style/Alias:
EnforcedStyle: prefer_alias_method
# Allow and/or for control flow only
Style/AndOr:
EnforcedStyle: conditionals
# Require at least two dependent lines before suggesting a guard clause
Style/GuardClause:
MinBodyLength: 2
# Sometimes an if statement just looks better than next with a guard clause
Style/Next:
Enabled: false
# Allow both real comparison and predicate methods
Style/NumericPredicate:
Enabled: false
# Allow explicit return with multiple return values
Style/RedundantReturn:
AllowMultipleReturnValues: true
# Do not commit to use of interpolation
Style/StringLiterals:
EnforcedStyle: double_quotes
# Make quoting outside and inside interpolation consistent
Style/StringLiteralsInInterpolation:
EnforcedStyle: double_quotes
# Disable to allow free choice
Style/SuperWithArgsParentheses:
Enabled: false
# Prefer symbols to look like symbols
Style/SymbolArray:
EnforcedStyle: brackets
# Accessors are only trivial if they match the ivar name.
# Also, allow accessors with ? in the name.
Style/TrivialAccessors:
ExactNameMatch: true
AllowPredicates: true
# Project-specific configuration goes here.
# GObject has a lot of accessor method starting with get_ or set_
Naming/AccessorMethodName:
Enabled: false
# GirFFI uses a gir_ffi-something naming scheme.
Naming/FileName:
Enabled: false
# TODO: See about has_ and have_
Naming/PredicateName:
ForbiddenPrefixes:
- is_
# In tests, we want to do this to be more clear
Performance/FixedSize:
Exclude:
- 'test/**/*.rb'