brew/Library/.rubocop_shared.yml

111 lines
2.6 KiB
YAML
Raw Normal View History

2018-11-22 23:45:23 +01:00
# TODO: Try getting more rules in sync.
2018-11-13 03:57:19 +01:00
require: ./Homebrew/rubocops.rb
2018-11-12 04:46:47 +01:00
AllCops:
TargetRubyVersion: 2.6
2018-11-12 04:46:47 +01:00
DisplayCopNames: false
2018-11-13 03:57:19 +01:00
# Use `<<~` for heredocs.
2019-11-28 15:10:50 +00:00
Layout/HeredocIndentation:
2018-11-13 03:57:19 +01:00
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:
2019-11-28 15:10:50 +00:00
ForbiddenDelimiters:
2018-11-13 03:57:19 +01:00
- 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
2019-10-03 08:50:45 +02:00
# Prefer tokens with type annotations for consistency
# between formatting numbers and strings.
2018-11-13 03:57:19 +01:00
Style/FormatStringToken:
2019-10-03 08:50:45 +02:00
EnforcedStyle: annotated
2018-11-13 03:57:19 +01:00
2020-02-19 11:18:29 +00:00
# autocorrectable and more readable
Style/HashEachMethods:
Enabled: true
Style/HashTransformKeys:
Enabled: true
Style/HashTransformValues:
Enabled: true
# This shouldn't be enabled until LineLength is lower.
2018-11-13 03:57:19 +01:00
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