158 lines
3.6 KiB
YAML
158 lines
3.6 KiB
YAML
|
|
# 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
|
|
|
|
# zero-prefixed octal literals are just too widely used (and mostly understood)
|
|
Style/NumericLiteralPrefix:
|
|
EnforcedOctalStyle: zero_only
|
|
|
|
# percent-x is allowed for multiline
|
|
Style/CommandLiteral:
|
|
EnforcedStyle: mixed
|
|
|
|
# paths abound, easy escape
|
|
Style/RegexpLiteral:
|
|
EnforcedStyle: slashes
|
|
|
|
Style/Alias:
|
|
EnforcedStyle: prefer_alias
|
|
|
|
# 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/**/*'
|
|
Style/IfUnlessModifier:
|
|
Exclude:
|
|
- 'Taps/**/*'
|
|
|
|
# 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
|
|
|
|
# dashes in filenames are typical
|
|
Style/FileName:
|
|
# matches:
|
|
# file_name.rb (default)
|
|
# file-name.rb, --filename.rb (command names)
|
|
# FILENAME.rb (ARGV and ENV)
|
|
# does not match:
|
|
# dashes-and_underscores.rb
|
|
Regex: !ruby/regexp /^((([\dA-Z]+|[\da-z\+]+)(_([\dA-Z]+|[\da-z\+]+))*|(\-\-)?([\dA-Z]+|[\da-z\+\.]+)([-@]([\dA-Z]+|[\da-z\+\.]+))*))(\.rb)?$/
|
|
|
|
# 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/**/*'
|
|
NameWhitelist: is_32_bit?, is_64_bit?
|
|
|
|
# `formula do` uses nested method definitions
|
|
Lint/NestedMethodDefinition:
|
|
Exclude:
|
|
- 'Homebrew/test/**/*'
|