brew/Library/.rubocop.yml

231 lines
5.5 KiB
YAML
Raw Normal View History

AllCops:
2017-09-24 19:10:57 +01:00
TargetRubyVersion: 2.3
2016-10-11 01:00:23 +02:00
Exclude:
- '**/Casks/**/*'
- '**/vendor/**/*'
DisplayCopNames: false
2017-02-12 11:07:03 +05:30
require: ./Homebrew/rubocops.rb
# enable all formulae audits
FormulaAudit:
Enabled: true
# enable all formulae strict audits
FormulaAuditStrict:
Enabled: true
# disable all formulae strict audits by default
NewFormulaAudit:
Enabled: false
2017-06-30 11:43:47 +05:30
# `system` is a special case and aligns on second argument
Layout/AlignParameters:
2016-09-18 14:27:09 +01:00
Enabled: false
2016-09-25 02:41:14 +02:00
# favour parens-less DSL-style arguments
Lint/AmbiguousOperator:
Enabled: false
# this is a bit less "floaty"
Layout/CaseIndentation:
EnforcedStyle: end
2016-09-18 14:27:09 +01:00
# this is a bit less "floaty"
2018-03-05 11:46:38 +00:00
Layout/EndAlignment:
EnforcedStyleAlignWith: start_of_line
2016-09-25 02:41:14 +02:00
# enforce use of <<~EOS
Layout/IndentHeredoc:
2017-10-15 02:28:32 +02:00
EnforcedStyle: squiggly
2016-09-25 02:41:14 +02:00
# conflicts with DSL-style path concatenation with `/`
Layout/SpaceAroundOperators:
2016-09-18 14:27:09 +01:00
Enabled: false
# use spaces for indentation; detect tabs
Layout/Tab:
Enabled: true
2018-09-17 02:45:00 +02:00
# Auto-correct is broken (https://github.com/rubocop-hq/rubocop/issues/6300).
Layout/EmptyLineAfterGuardClause:
Enabled: false
# favour parens-less DSL-style arguments
Lint/AmbiguousBlockAssociation:
2016-09-18 14:27:09 +01:00
Enabled: false
2016-09-25 02:41:14 +02:00
# so many of these in formulae and can't be autocorrected
# TODO: fix these as `ruby -w` complains about them.
2016-09-18 14:27:09 +01:00
Lint/AmbiguousRegexpLiteral:
Enabled: false
2016-09-25 02:41:14 +02:00
# assignment in conditions are useful sometimes
# TODO: add parentheses for these and remove
2016-09-18 14:27:09 +01:00
Lint/AssignmentInCondition:
Enabled: false
2016-09-25 02:41:14 +02:00
# we output how to use interpolated strings too often
Lint/InterpolationCheck:
Enabled: false
# so many of these in formulae and can't be autocorrected
2016-09-18 14:27:09 +01:00
Lint/ParenthesesAsGroupedExpression:
Enabled: false
# most metrics don't make sense to apply for formulae/taps
Metrics/AbcSize:
Enabled: false
Metrics/BlockLength:
Enabled: false
Metrics/ClassLength:
Enabled: false
Metrics/CyclomaticComplexity:
Enabled: false
Metrics/MethodLength:
Enabled: false
# Metrics/ModuleLength:
# Enabled: false
Metrics/PerceivedComplexity:
Enabled: false
# keyword arguments don't have the same readability problems
Metrics/ParameterLists:
CountKeywordArgs: false
# GitHub diff UI wraps beyond 118 characters (so that's the goal)
Metrics/LineLength:
Max: 189
# ignore manpage comments and long single-line strings
IgnoredPatterns: ['#: ', ' url "', ' mirror "', ' plist_options :']
# dashes in filenames are typical
Naming/FileName:
Regex: !ruby/regexp /^[\w\@\-\+\.]+(\.rb)?$/
# implicitly allow EOS as we use it everywhere
Naming/HeredocDelimiterNaming:
Blacklist:
- END, EOD, EOF
# we have too many variables like sha256 where this harms readability
Naming/VariableNumber:
Enabled: false
# makes code less readable for minor performance increases
Performance/Caller:
2016-09-25 02:41:14 +02:00
Enabled: false
# we're doing this already so why not
Performance/CaseWhenSplat:
Enabled: true
# enable to avoid leaking resources
Style/AutoResourceCleanup:
Enabled: true
# this is a little more obvious what's going on
Style/BarePercentLiterals:
EnforcedStyle: percent_q
# consistency helps readability and helps people who don't know Ruby
Style/CollectionMethods:
Enabled: true
2016-09-25 02:41:14 +02:00
# our current conditional style is established
# TODO: enable this when possible
2016-09-25 02:41:14 +02:00
Style/ConditionalAssignment:
Enabled: false
# most of our APIs are internal so don't require docs
2016-09-25 02:41:14 +02:00
Style/Documentation:
Enabled: false
# we don't need UTF-8 encoding comments
Style/Encoding:
Enabled: true
2016-09-18 14:27:09 +01:00
# falsely flags e.g. curl formatting arguments as format strings
Style/FormatStringToken:
EnforcedStyle: template
# we want to add this slowly and manually
# TODO: add to more files
Style/FrozenStringLiteralComment:
Enabled: false
# so many of these in formulae and can't be autocorrected
Style/GuardClause:
Enabled: false
# depends_on a: :b looks weird in formulae.
Style/HashSyntax:
EnforcedStyle: hash_rockets
Exclude:
- '**/bin/**/*'
- '**/cmd/**/*'
- '**/lib/**/*'
- '**/spec/**/*'
# this doesn't make sense for wide lines below maximum line length
# https://github.com/rubocop-hq/rubocop/issues/6149
Style/IfUnlessModifier:
Enabled: false
2016-09-25 02:41:14 +02:00
# only for numbers >= 1_000_000
Style/NumericLiterals:
MinDigits: 7
# zero-prefixed octal literals are just too widely used (and understood)
2016-09-25 02:41:14 +02:00
Style/NumericLiteralPrefix:
EnforcedOctalStyle: zero_only
# rescuing StandardError is an understood default
Style/RescueStandardError:
EnforcedStyle: implicit
# return nil is unnecessary and a common mistake believing it's required
Style/ReturnNil:
Enabled: true
# We have no use for using `warn` because we are
# calling Ruby with warnings disabled ourselves (for now).
Style/StderrPuts:
Enabled: false
2016-09-25 02:41:14 +02:00
# ruby style guide favorite
Style/StringLiterals:
EnforcedStyle: double_quotes
2016-09-18 14:27:09 +01:00
2016-09-25 02:41:14 +02:00
# consistency with above
Style/StringLiteralsInInterpolation:
EnforcedStyle: double_quotes
2016-09-20 21:13:04 +02:00
# consistency helps readability and helps people who don't know Ruby
Style/StringMethods:
Enabled: true
# less confusing to non-Rubyists
Style/SymbolArray:
EnforcedStyle: brackets
# make things a bit easier to read
Style/TernaryParentheses:
EnforcedStyle: require_parentheses_when_complex
# messes with existing plist/caveats style
Style/TrailingBodyOnMethodDefinition:
Enabled: false
# all trailing commas make diffs nicer
Style/TrailingCommaInArguments:
EnforcedStyleForMultiline: comma
2018-03-05 11:46:38 +00:00
Style/TrailingCommaInArrayLiteral:
EnforcedStyleForMultiline: comma
Style/TrailingCommaInHashLiteral:
2016-09-18 14:27:09 +01:00
EnforcedStyleForMultiline: comma
# a bit confusing to non-Rubyists but useful for longer arrays
2016-09-25 02:41:14 +02:00
Style/WordArray:
MinSize: 4