brew/Library/Homebrew/.rubocop.yml
2020-08-26 03:13:59 +02:00

155 lines
3.0 KiB
YAML

inherit_from:
- ../.rubocop_rspec.yml
- .rubocop_todo.yml
AllCops:
Include:
- '**/*.rb'
- 'Library/Homebrew/.simplecov'
Exclude:
- 'bin/*'
- '**/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
# TODO: try to bring down all metrics maximums
Metrics/AbcSize:
Enabled: true
Max: 250
Metrics/BlockLength:
Enabled: true
Max: 100
Exclude:
- 'test/**/*'
Metrics/BlockNesting:
Enabled: true
Max: 5
Metrics/ClassLength:
Enabled: true
Max: 800
Exclude:
- 'formula.rb'
- 'formula_installer.rb'
Metrics/CyclomaticComplexity:
Enabled: true
Max: 80
Metrics/MethodLength:
Enabled: true
Max: 260
Metrics/ModuleLength:
Enabled: true
Max: 600
Exclude:
- 'test/**/*'
Metrics/PerceivedComplexity:
Enabled: true
Max: 90
# we won't change backward compatible predicate names
Naming/PredicateName:
Exclude:
- 'compat/**/*'
# can't rename these
AllowedMethods: is_32_bit?, is_64_bit?
# allow 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
# don't group nicely documented or private attr_readers
Style/AccessorGrouping:
Exclude:
- 'formula.rb'
- 'formulary.rb'
- 'migrator.rb'
- 'resource.rb'
- 'system_command.rb'
- 'tap.rb'
# make rspec formatting more flexible
Style/BlockDelimiters:
Exclude:
- '**/*_spec.rb'
- '**/shared_examples/**/*.rb'
# document our public APIs
Style/Documentation:
Enabled: true
Style/DocumentationMethod:
Enabled: true
Include:
- 'formula.rb'
# don't want this for formulae but re-enabled for Library/Homebrew
Style/FrozenStringLiteralComment:
Enabled: true
EnforcedStyle: always
Exclude:
- '**/Casks/**/*.rb'
# so many of these in formulae but none in here
Style/GuardClause:
Enabled: true
# so many of these in formulae but none in here
Style/StringConcatenation:
Enabled: true
# don't want this for formulae but re-enabled for Library/Homebrew
Style/HashAsLastArrayItem:
Enabled: true
Exclude:
- 'test/utils/spdx_spec.rb'