brew/Library/.rubocop_rules.yml

157 lines
3.5 KiB
YAML
Raw Normal View History

2016-09-18 14:27:09 +01:00
# ruby style guide favorite
Style/StringLiterals:
EnforcedStyle: double_quotes
# consistency with above
Style/StringLiteralsInInterpolation:
EnforcedStyle: double_quotes
# only for numbers >= 1_000_000
Style/NumericLiterals:
MinDigits: 7
2016-09-21 09:22:21 +02:00
# zero-prefixed octal literals are just too widely used (and mostly understood)
Style/NumericLiteralPrefix:
EnforcedOctalStyle: zero_only
2016-09-18 14:27:09 +01:00
# percent-x is allowed for multiline
Style/CommandLiteral:
EnforcedStyle: mixed
# depends_on foo: :bar looks rubbish
Style/HashSyntax:
EnforcedStyle: ruby19
Exclude:
- 'Taps/**/*'
2016-09-18 14:27:09 +01:00
# paths abound, easy escape
Style/RegexpLiteral:
EnforcedStyle: slashes
Style/Alias:
2016-09-23 18:13:48 +02:00
EnforcedStyle: prefer_alias
2016-09-18 14:27:09 +01:00
# our current conditional style is established, clear and
# requiring users to change that now would be confusing.
Style/ConditionalAssignment:
Enabled: false
# no metrics for formulas
Metrics/AbcSize:
Enabled: false
Metrics/CyclomaticComplexity:
Enabled: false
Metrics/MethodLength:
Enabled: false
Metrics/ClassLength:
Enabled: false
Metrics/PerceivedComplexity:
Enabled: false
# we often need very long lines
Metrics/LineLength:
Enabled: false
# formulas have no mandatory doc
Style/Documentation:
Enabled: false
# favor parens-less DSL-style arguments
Lint/AmbiguousOperator:
Enabled: false
Lint/AmbiguousRegexpLiteral:
Enabled: false
Lint/AssignmentInCondition:
Enabled: false
Lint/ParenthesesAsGroupedExpression:
Enabled: false
# compact style
Style/EmptyLineBetweenDefs:
AllowAdjacentOneLineDefs: true
# consistency and readability when faced with string interpolation
Style/PercentLiteralDelimiters:
PreferredDelimiters:
'%': '()'
'%i': '()'
'%q': '()'
'%Q': '()'
'%r': '{}'
'%s': '()'
'%w': '[]'
'%W': '[]'
'%x': '()'
# conflicts with DSL-style path concatenation with `/`
Style/SpaceAroundOperators:
Enabled: false
# not a problem for typical shell users
Style/SpecialGlobalVars:
Enabled: false
# `system` is a special case and aligns on second argument
Style/AlignParameters:
Enabled: false
# counterproductive in formulas, notably within the install method
Style/GuardClause:
Exclude:
- 'Taps/**/*'
2016-09-18 14:27:09 +01:00
Style/IfUnlessModifier:
Exclude:
- 'Taps/**/*'
2016-09-18 14:27:09 +01:00
2016-09-20 21:13:04 +02:00
# TODO: enforce when rubocop has fixed this
# https://github.com/bbatsov/rubocop/issues/3516
Style/VariableNumber:
Enabled: false
# TODO: enforce when rubocop has shipped this
# https://github.com/bbatsov/rubocop/pull/3513
Style/TernaryParentheses:
Enabled: false
2016-09-18 14:27:09 +01:00
# dashes in filenames are typical
Style/FileName:
2016-09-23 22:03:23 +02:00
Regex: !ruby/regexp /^[\w\@\-\+\.]+(\.rb)?$/
2016-09-18 14:27:09 +01:00
# no percent word array, being friendly to non-ruby users
# TODO: enforce when rubocop has fixed this
# https://github.com/bbatsov/rubocop/issues/1543
Style/WordArray:
Enabled: false
Style/UnneededCapitalW:
Enabled: false
# we prefer compact if-else-end/case-when-end alignment
Lint/EndAlignment:
AlignWith: variable
Style/CaseIndentation:
IndentWhenRelativeTo: end
# we prefer Perl-style regex back references
Style/PerlBackrefs:
Enabled: false
# makes diffs nicer
Style/TrailingCommaInLiteral:
EnforcedStyleForMultiline: comma
# we won't change backward compatible method names
Style/MethodName:
Exclude:
- 'Homebrew/compat/**/*'
# we won't change backward compatible predicate names
Style/PredicateName:
Exclude:
- 'Homebrew/compat/**/*'
2016-09-21 09:48:24 +02:00
NameWhitelist: is_32_bit?, is_64_bit?
2016-09-18 14:27:09 +01:00
# `formula do` uses nested method definitions
Lint/NestedMethodDefinition:
Exclude:
- 'Homebrew/test/**/*'