brew/Library/.rubocop.yml
Mike McQuaid ed9942fbd1 Merge pull request #2769 from MikeMcQuaid/rubocop-no-perl-backrefs
rubocop: don’t allow Perl regex backrefs.
2017-06-12 16:47:28 +01:00

209 lines
4.0 KiB
YAML

AllCops:
TargetRubyVersion: 2.0
Exclude:
- '**/Casks/**/*'
- '**/vendor/**/*'
require: ./Homebrew/rubocops.rb
FormulaAudit/Text:
Enabled: true
FormulaAudit/Caveats:
Enabled: true
FormulaAuditStrict/BottleBlock:
Enabled: true
FormulaAuditStrict/Desc:
Enabled: true
FormulaAuditStrict/ComponentsOrder:
Enabled: true
FormulaAuditStrict/ComponentsRedundancy:
Enabled: true
FormulaAudit/Homepage:
Enabled: true
# `system` is a special case and aligns on second argument
Layout/AlignParameters:
Enabled: false
Layout/CaseIndentation:
EnforcedStyle: end
Layout/EmptyLineBetweenDefs:
AllowAdjacentOneLineDefs: true
Layout/IndentArray:
EnforcedStyle: special_inside_parentheses
Layout/IndentHeredoc:
EnforcedStyle: unindent
# conflicts with DSL-style path concatenation with `/`
Layout/SpaceAroundOperators:
Enabled: false
# favor parens-less DSL-style arguments
Lint/AmbiguousOperator:
Enabled: false
# so many of these in formulae and can't be autocorrected
Lint/AmbiguousRegexpLiteral:
Enabled: false
# favor parens-less DSL-style arguments
Lint/AmbiguousBlockAssociation:
Enabled: false
# assignment in conditions are useful sometimes
Lint/AssignmentInCondition:
Enabled: false
Lint/EndAlignment:
EnforcedStyleAlignWith: variable
# so many of these in formulae and can't be autocorrected
Lint/ParenthesesAsGroupedExpression:
Enabled: false
# TODO: try to bring down all metrics maximums
Metrics/AbcSize:
Max: 250
Metrics/BlockLength:
Max: 1250
Metrics/ClassLength:
Max: 1500
Metrics/CyclomaticComplexity:
Max: 75
Metrics/LineLength:
Max: 400
Metrics/MethodLength:
Max: 250
Metrics/ModuleLength:
CountComments: false
Exclude:
- '**/bin/**/*'
- '**/cmd/**/*'
- '**/lib/**/*'
Metrics/PerceivedComplexity:
Max: 80
# makes code less readable for minor performance increases
Performance/Caller:
Enabled: false
Style/Alias:
EnforcedStyle: prefer_alias
Style/AutoResourceCleanup:
Enabled: true
Style/BarePercentLiterals:
EnforcedStyle: percent_q
Style/BlockDelimiters:
EnforcedStyle: line_count_based
Style/ClassAndModuleChildren:
EnforcedStyle: nested
# our current conditional style is established, clear and
# requiring users to change that now would be confusing.
Style/ConditionalAssignment:
Enabled: false
# most of our APIs are internal so don't require docs
Style/Documentation:
Enabled: false
Style/Encoding:
Enabled: true
# dashes in filenames are typical
Style/FileName:
Regex: !ruby/regexp /^[\w\@\-\+\.]+(\.rb)?$/
# falsely flags e.g. curl formatting arguments as format strings
Style/FormatStringToken:
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/**/*'
# only for numbers >= 1_000_000
Style/NumericLiterals:
MinDigits: 7
# zero-prefixed octal literals are just too widely used (and mostly understood)
Style/NumericLiteralPrefix:
EnforcedOctalStyle: zero_only
# consistency and readability when faced with string interpolation
Style/PercentLiteralDelimiters:
PreferredDelimiters:
'%': '()'
'%i': '()'
'%q': '()'
'%Q': '()'
'%r': '{}'
'%s': '()'
'%w': '[]'
'%W': '[]'
'%x': '()'
Style/RaiseArgs:
EnforcedStyle: exploded
# paths abound, easy escape
Style/RegexpLiteral:
EnforcedStyle: slashes
# ruby style guide favorite
Style/StringLiterals:
EnforcedStyle: double_quotes
# consistency with above
Style/StringLiteralsInInterpolation:
EnforcedStyle: double_quotes
Style/SymbolArray:
EnforcedStyle: brackets
Style/TernaryParentheses:
EnforcedStyle: require_parentheses_when_complex
# makes diffs nicer
Style/TrailingCommaInLiteral:
EnforcedStyleForMultiline: comma
Style/TrailingCommaInArguments:
EnforcedStyleForMultiline: comma
# we have too many variables like sha256 where this harms readability
Style/VariableNumber:
Enabled: false
Style/WordArray:
MinSize: 4