brew/Library/Homebrew/.rubocop.yml
Mike McQuaid c040331468
rubocop: enable Style/TrailingBodyOnMethodDefinition.
This is default, more consistent with Ruby style and autocorrectable.

I have updated the usage in Homebrew/core to be consistent.
2020-03-14 19:46:23 +00:00

142 lines
2.8 KiB
YAML

inherit_from: ../.rubocop_rspec.yml
AllCops:
Include:
- '**/*.rb'
- 'Library/Homebrew/.simplecov'
Exclude:
- 'bin/*'
- '**/Casks/**/*'
- '**/vendor/**/*'
# messes up system formatting for formulae but good for Homebrew/brew
Layout/ArgumentAlignment:
Enabled: true
# make rspec formatting more flexible
Layout/MultilineMethodCallIndentation:
Exclude:
- '**/*_spec.rb'
# so many of these in formulae but none in here
Lint/AmbiguousRegexpLiteral:
Enabled: true
# TODO: add parentheses for these and remove
Lint/AssignmentInCondition:
Enabled: false
# `formula do` uses nested method definitions
Lint/NestedMethodDefinition:
Exclude:
- 'test/**/*'
# so many of these in formulae but none in here
Lint/ParenthesesAsGroupedExpression:
Enabled: true
# unused keyword arguments improve APIs
Lint/UnusedMethodArgument:
AllowUnusedKeywordArguments: true
# TODO: try to bring down all metrics maximums
Metrics/AbcSize:
Enabled: true
Max: 275
Metrics/BlockLength:
Enabled: true
Max: 1100
Metrics/BlockNesting:
Enabled: true
Max: 5
Metrics/ClassLength:
Enabled: true
Max: 1400
Metrics/CyclomaticComplexity:
Enabled: true
Max: 75
Metrics/MethodLength:
Enabled: true
Max: 300
Metrics/ModuleLength:
Enabled: true
Max: 550
Metrics/PerceivedComplexity:
Enabled: true
Max: 100
# we won't change backward compatible predicate names
Naming/PredicateName:
Exclude:
- 'compat/**/*'
# can't rename these
AllowedMethods: is_32_bit?, is_64_bit?
# whitelist those that are standard
# TODO: try to remove some of these
Naming/MethodParameterName:
AllowedNames:
- '_'
- 'a'
- 'b'
- 'cc'
- 'c1'
- 'c2'
- 'd'
- 'e'
- 'f'
- 'ff'
- 'fn'
- 'id'
- 'io'
- 'o'
- 'p'
- 'pr'
- 'r'
- 'rb'
- 's'
- 'to'
- 'v'
# Avoid false positives on modifiers used on symbols of methods
# See https://github.com/rubocop-hq/rubocop/issues/5953
Style/AccessModifierDeclarations:
Enabled: false
# make rspec formatting more flexible
Style/BlockDelimiters:
Exclude:
- '**/*_spec.rb'
- '**/shared_examples/**/*.rb'
# document our public APIs
Style/Documentation:
Enabled: true
Include:
- 'Library/Homebrew/formula.rb'
Style/DocumentationMethod:
Enabled: true
Include:
- 'Library/Homebrew/formula.rb'
# don't want this for formulae but re-enabled for Library/Homebrew
Style/FrozenStringLiteralComment:
Enabled: true
EnforcedStyle: always
# so many of these in formulae but none in here
Style/GuardClause:
Enabled: true
# hash-rockets preferred for formulae, a: 1 preferred here
Style/HashSyntax:
EnforcedStyle: ruby19_no_mixed_keys
# would rather freeze too much than too little
Style/MutableConstant:
EnforcedStyle: strict
# LineLength is low enough here to re-enable it.
Style/IfUnlessModifier:
Enabled: true