- This was set to 2.3 because Homebrew was running Ruby 2.3.7. Since https://github.com/Homebrew/brew/pull/6556, we're running 2.6.3. With this change, Rubocop will check against modern Ruby syntax.
103 lines
2.4 KiB
YAML
103 lines
2.4 KiB
YAML
# TODO: Try getting more rules in sync.
|
|
|
|
require: ./Homebrew/rubocops.rb
|
|
|
|
AllCops:
|
|
TargetRubyVersion: 2.6
|
|
DisplayCopNames: false
|
|
|
|
# Use `<<~` for heredocs.
|
|
Layout/IndentHeredoc:
|
|
EnforcedStyle: squiggly
|
|
|
|
# Not useful in casks and formulae.
|
|
Metrics/BlockLength:
|
|
Enabled: false
|
|
|
|
# Keyword arguments don't have the same readability
|
|
# problems as normal parameters.
|
|
Metrics/ParameterLists:
|
|
CountKeywordArgs: false
|
|
|
|
# Implicitly allow EOS as we use it everywhere.
|
|
Naming/HeredocDelimiterNaming:
|
|
Blacklist:
|
|
- END, EOD, EOF
|
|
|
|
# Allow dashes in filenames.
|
|
Naming/FileName:
|
|
Regex: !ruby/regexp /^[\w\@\-\+\.]+(\.rb)?$/
|
|
|
|
# Both styles are used depending on context,
|
|
# e.g. `sha256` and `something_countable_1`.
|
|
Naming/VariableNumber:
|
|
Enabled: false
|
|
|
|
# Avoid leaking resources.
|
|
Style/AutoResourceCleanup:
|
|
Enabled: true
|
|
|
|
# This makes these a little more obvious.
|
|
Style/BarePercentLiterals:
|
|
EnforcedStyle: percent_q
|
|
|
|
# Use consistent style for better readability.
|
|
Style/CollectionMethods:
|
|
Enabled: true
|
|
|
|
# Prefer tokens with type annotations for consistency
|
|
# between formatting numbers and strings.
|
|
Style/FormatStringToken:
|
|
EnforcedStyle: annotated
|
|
|
|
# This shouldn't be enabled until LineLength is lower.
|
|
Style/IfUnlessModifier:
|
|
Enabled: false
|
|
|
|
# Only use this for numbers >= `1_000_000`.
|
|
Style/NumericLiterals:
|
|
MinDigits: 7
|
|
Strict: true
|
|
|
|
# Zero-prefixed octal literals are widely used and understood.
|
|
Style/NumericLiteralPrefix:
|
|
EnforcedOctalStyle: zero_only
|
|
|
|
# Rescuing `StandardError` is an understood default.
|
|
Style/RescueStandardError:
|
|
EnforcedStyle: implicit
|
|
|
|
# Returning `nil` is unnecessary.
|
|
Style/ReturnNil:
|
|
Enabled: true
|
|
|
|
# We have no use for using `warn` because we
|
|
# are calling Ruby with warnings disabled.
|
|
Style/StderrPuts:
|
|
Enabled: false
|
|
|
|
# Use consistent method names.
|
|
Style/StringMethods:
|
|
Enabled: true
|
|
|
|
# An array of symbols is more readable than a symbol array
|
|
# and also allows for easier grepping.
|
|
Style/SymbolArray:
|
|
EnforcedStyle: brackets
|
|
|
|
# Trailing commas make diffs nicer.
|
|
Style/TrailingCommaInArguments:
|
|
EnforcedStyleForMultiline: comma
|
|
Style/TrailingCommaInArrayLiteral:
|
|
EnforcedStyleForMultiline: comma
|
|
Style/TrailingCommaInHashLiteral:
|
|
EnforcedStyleForMultiline: comma
|
|
|
|
# Does not hinder readability, so might as well enable it.
|
|
Performance/CaseWhenSplat:
|
|
Enabled: true
|
|
|
|
# Makes code less readable for minor performance increases.
|
|
Performance/Caller:
|
|
Enabled: false
|