Consolidate some rubocop configurations
This commit is contained in:
parent
7ac31f7d65
commit
ed8363fd72
@ -1,9 +1,10 @@
|
|||||||
# TODO: Try getting more rules in sync.
|
---
|
||||||
|
|
||||||
require:
|
require:
|
||||||
- ./Homebrew/rubocops.rb
|
- ./Homebrew/rubocops.rb
|
||||||
- rubocop-performance
|
- rubocop-performance
|
||||||
- rubocop-rails
|
- rubocop-rails
|
||||||
|
- rubocop-rspec
|
||||||
|
- rubocop-sorbet
|
||||||
|
|
||||||
inherit_mode:
|
inherit_mode:
|
||||||
merge:
|
merge:
|
||||||
@ -15,7 +16,6 @@ AllCops:
|
|||||||
TargetRubyVersion: 2.6
|
TargetRubyVersion: 2.6
|
||||||
DisplayCopNames: false
|
DisplayCopNames: false
|
||||||
ActiveSupportExtensionsEnabled: true
|
ActiveSupportExtensionsEnabled: true
|
||||||
# enable all pending rubocops
|
|
||||||
NewCops: enable
|
NewCops: enable
|
||||||
Include:
|
Include:
|
||||||
- "**/*.rbi"
|
- "**/*.rbi"
|
||||||
@ -47,15 +47,12 @@ Cask/StanzaOrder:
|
|||||||
Description: "Ensure that cask stanzas are sorted correctly. More info at https://docs.brew.sh/Cask-Cookbook#stanza-order"
|
Description: "Ensure that cask stanzas are sorted correctly. More info at https://docs.brew.sh/Cask-Cookbook#stanza-order"
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
|
||||||
# enable all formulae audits
|
|
||||||
FormulaAudit:
|
FormulaAudit:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
|
||||||
# enable all formulae strict audits
|
|
||||||
FormulaAuditStrict:
|
FormulaAuditStrict:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
|
||||||
# enable all Homebrew custom cops
|
|
||||||
Homebrew:
|
Homebrew:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
|
||||||
@ -63,6 +60,71 @@ Homebrew:
|
|||||||
Homebrew/MoveToExtendOS:
|
Homebrew/MoveToExtendOS:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
|
# `system` is a special case and aligns on second argument, so allow this for formulae.
|
||||||
|
Layout/ArgumentAlignment:
|
||||||
|
Exclude:
|
||||||
|
- "Taps/*/*/*.rb"
|
||||||
|
- "/**/Formula/*.rb"
|
||||||
|
- "**/Formula/*.rb"
|
||||||
|
|
||||||
|
# this is a bit less "floaty"
|
||||||
|
Layout/CaseIndentation:
|
||||||
|
EnforcedStyle: end
|
||||||
|
|
||||||
|
# significantly less indentation involved; more consistent
|
||||||
|
Layout/FirstArrayElementIndentation:
|
||||||
|
EnforcedStyle: consistent
|
||||||
|
Layout/FirstHashElementIndentation:
|
||||||
|
EnforcedStyle: consistent
|
||||||
|
|
||||||
|
# this is a bit less "floaty"
|
||||||
|
Layout/EndAlignment:
|
||||||
|
EnforcedStyleAlignWith: start_of_line
|
||||||
|
|
||||||
|
# make our hashes consistent
|
||||||
|
Layout/HashAlignment:
|
||||||
|
EnforcedHashRocketStyle: table
|
||||||
|
EnforcedColonStyle: table
|
||||||
|
|
||||||
|
# Need to allow #: for external commands.
|
||||||
|
Layout/LeadingCommentSpace:
|
||||||
|
Exclude:
|
||||||
|
- "Taps/*/*/cmd/*.rb"
|
||||||
|
|
||||||
|
# GitHub diff UI wraps beyond 118 characters
|
||||||
|
Layout/LineLength:
|
||||||
|
Max: 118
|
||||||
|
# ignore manpage comments and long single-line strings
|
||||||
|
AllowedPatterns:
|
||||||
|
[
|
||||||
|
"#: ",
|
||||||
|
' url "',
|
||||||
|
' mirror "',
|
||||||
|
" plist_options ",
|
||||||
|
' appcast "',
|
||||||
|
' executable: "',
|
||||||
|
' font "',
|
||||||
|
' homepage "',
|
||||||
|
' name "',
|
||||||
|
' pkg "',
|
||||||
|
' pkgutil: "',
|
||||||
|
" sha256 cellar: ",
|
||||||
|
" sha256 ",
|
||||||
|
"#{language}",
|
||||||
|
"#{version.",
|
||||||
|
' "/Library/Application Support/',
|
||||||
|
'"/Library/Caches/',
|
||||||
|
'"/Library/PreferencePanes/',
|
||||||
|
' "~/Library/Application Support/',
|
||||||
|
'"~/Library/Caches/',
|
||||||
|
'"~/Application Support',
|
||||||
|
" was verified as official when first introduced to the cask",
|
||||||
|
]
|
||||||
|
|
||||||
|
# conflicts with DSL-style path concatenation with `/`
|
||||||
|
Layout/SpaceAroundOperators:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
# makes DSL usage ugly.
|
# makes DSL usage ugly.
|
||||||
Layout/SpaceBeforeBrackets:
|
Layout/SpaceBeforeBrackets:
|
||||||
Exclude:
|
Exclude:
|
||||||
@ -71,6 +133,31 @@ Layout/SpaceBeforeBrackets:
|
|||||||
- "/**/{Formula,Casks}/*.rb"
|
- "/**/{Formula,Casks}/*.rb"
|
||||||
- "**/{Formula,Casks}/*.rb"
|
- "**/{Formula,Casks}/*.rb"
|
||||||
|
|
||||||
|
# favour parens-less DSL-style arguments
|
||||||
|
Lint/AmbiguousBlockAssociation:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Lint/DuplicateBranch:
|
||||||
|
Exclude:
|
||||||
|
- "Taps/*/*/*.rb"
|
||||||
|
- "/**/{Formula,Casks}/*.rb"
|
||||||
|
- "**/{Formula,Casks}/*.rb"
|
||||||
|
|
||||||
|
# so many of these in formulae and can't be autocorrected
|
||||||
|
Lint/ParenthesesAsGroupedExpression:
|
||||||
|
Exclude:
|
||||||
|
- "Taps/*/*/*.rb"
|
||||||
|
- "/**/Formula/*.rb"
|
||||||
|
- "**/Formula/*.rb"
|
||||||
|
|
||||||
|
# unused keyword arguments improve APIs
|
||||||
|
Lint/UnusedMethodArgument:
|
||||||
|
AllowUnusedKeywordArguments: true
|
||||||
|
|
||||||
|
# These metrics didn't end up helping.
|
||||||
|
Metrics:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
# Allow dashes in filenames.
|
# Allow dashes in filenames.
|
||||||
Naming/FileName:
|
Naming/FileName:
|
||||||
Regex: !ruby/regexp /^[\w\@\-\+\.]+(\.rb)?$/
|
Regex: !ruby/regexp /^[\w\@\-\+\.]+(\.rb)?$/
|
||||||
@ -96,88 +183,37 @@ Naming/MethodName:
|
|||||||
AllowedPatterns:
|
AllowedPatterns:
|
||||||
- '\A(fetch_)?HEAD\?\Z'
|
- '\A(fetch_)?HEAD\?\Z'
|
||||||
|
|
||||||
|
# allow those that are standard
|
||||||
|
# TODO: try to remove some of these
|
||||||
|
Naming/MethodParameterName:
|
||||||
|
inherit_mode:
|
||||||
|
merge:
|
||||||
|
- AllowedNames
|
||||||
|
AllowedNames:
|
||||||
|
- "a"
|
||||||
|
- "b"
|
||||||
|
- "cc"
|
||||||
|
- "c1"
|
||||||
|
- "c2"
|
||||||
|
- "d"
|
||||||
|
- "e"
|
||||||
|
- "f"
|
||||||
|
- "ff"
|
||||||
|
- "fn"
|
||||||
|
- "id"
|
||||||
|
- "o"
|
||||||
|
- "p"
|
||||||
|
- "pr"
|
||||||
|
- "r"
|
||||||
|
- "rb"
|
||||||
|
- "s"
|
||||||
|
- "v"
|
||||||
|
|
||||||
# Both styles are used depending on context,
|
# Both styles are used depending on context,
|
||||||
# e.g. `sha256` and `something_countable_1`.
|
# e.g. `sha256` and `something_countable_1`.
|
||||||
Naming/VariableNumber:
|
Naming/VariableNumber:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
# Require &&/|| instead of and/or
|
|
||||||
Style/AndOr:
|
|
||||||
EnforcedStyle: always
|
|
||||||
|
|
||||||
# Avoid leaking resources.
|
|
||||||
Style/AutoResourceCleanup:
|
|
||||||
Enabled: true
|
|
||||||
|
|
||||||
# This makes these a little more obvious.
|
|
||||||
Style/BarePercentLiterals:
|
|
||||||
EnforcedStyle: percent_q
|
|
||||||
|
|
||||||
# Use consistent style for better readability.
|
|
||||||
Style/CollectionMethods:
|
|
||||||
Enabled: true
|
|
||||||
|
|
||||||
# This is quite a large change, so don't enforce this yet for formulae.
|
|
||||||
# We should consider doing so in the future, but be aware of the impact on third-party taps.
|
|
||||||
Style/FetchEnvVar:
|
|
||||||
Exclude:
|
|
||||||
- "Taps/*/*/*.rb"
|
|
||||||
- "/**/Formula/*.rb"
|
|
||||||
- "**/Formula/*.rb"
|
|
||||||
|
|
||||||
# Prefer tokens with type annotations for consistency
|
|
||||||
# between formatting numbers and strings.
|
|
||||||
Style/FormatStringToken:
|
|
||||||
EnforcedStyle: annotated
|
|
||||||
|
|
||||||
# Allow for license expressions
|
|
||||||
Style/HashAsLastArrayItem:
|
|
||||||
Exclude:
|
|
||||||
- "Taps/*/*/*.rb"
|
|
||||||
- "/**/Formula/*.rb"
|
|
||||||
- "**/Formula/*.rb"
|
|
||||||
|
|
||||||
# Only use this for numbers >= `1_000_000`.
|
|
||||||
Style/NumericLiterals:
|
|
||||||
MinDigits: 7
|
|
||||||
Strict: true
|
|
||||||
Exclude:
|
|
||||||
- "**/Brewfile"
|
|
||||||
|
|
||||||
# Zero-prefixed octal literals are widely used and understood.
|
|
||||||
Style/NumericLiteralPrefix:
|
|
||||||
EnforcedOctalStyle: zero_only
|
|
||||||
|
|
||||||
# Rescuing `StandardError` is an understood default.
|
|
||||||
Style/RescueStandardError:
|
|
||||||
EnforcedStyle: implicit
|
|
||||||
|
|
||||||
# Returning `nil` is unnecessary.
|
|
||||||
Style/ReturnNil:
|
|
||||||
Enabled: true
|
|
||||||
|
|
||||||
# We have no use for using `warn` because we
|
|
||||||
# are calling Ruby with warnings disabled.
|
|
||||||
Style/StderrPuts:
|
|
||||||
Enabled: false
|
|
||||||
|
|
||||||
# Use consistent method names.
|
|
||||||
Style/StringMethods:
|
|
||||||
Enabled: true
|
|
||||||
|
|
||||||
# An array of symbols is more readable than a symbol array
|
|
||||||
# and also allows for easier grepping.
|
|
||||||
Style/SymbolArray:
|
|
||||||
EnforcedStyle: brackets
|
|
||||||
|
|
||||||
# Trailing commas make diffs nicer.
|
|
||||||
Style/TrailingCommaInArguments:
|
|
||||||
EnforcedStyleForMultiline: comma
|
|
||||||
Style/TrailingCommaInArrayLiteral:
|
|
||||||
EnforcedStyleForMultiline: comma
|
|
||||||
Style/TrailingCommaInHashLiteral:
|
|
||||||
EnforcedStyleForMultiline: comma
|
|
||||||
|
|
||||||
# Does not hinder readability, so might as well enable it.
|
# Does not hinder readability, so might as well enable it.
|
||||||
Performance/CaseWhenSplat:
|
Performance/CaseWhenSplat:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
@ -193,7 +229,7 @@ Performance/MethodObjectAsBlock:
|
|||||||
Rails:
|
Rails:
|
||||||
# Selectively enable what we want.
|
# Selectively enable what we want.
|
||||||
Enabled: false
|
Enabled: false
|
||||||
# Cannot use ActiveSupport in RuboCops.
|
# Do not use ActiveSupport in RuboCops.
|
||||||
Exclude:
|
Exclude:
|
||||||
- "Homebrew/rubocops/**/*"
|
- "Homebrew/rubocops/**/*"
|
||||||
|
|
||||||
@ -233,126 +269,40 @@ Rails/StripHeredoc:
|
|||||||
Rails/ToFormattedS:
|
Rails/ToFormattedS:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
|
||||||
# Don't allow cops to be disabled in casks and formulae.
|
# Intentionally disabled as it doesn't fit with our code style.
|
||||||
Style/DisableCopsWithinSourceCodeDirective:
|
RSpec/AnyInstance:
|
||||||
Enabled: true
|
Enabled: false
|
||||||
Include:
|
RSpec/FilePath:
|
||||||
- "Taps/*/*/*.rb"
|
Enabled: false
|
||||||
- "/**/{Formula,Casks}/*.rb"
|
RSpec/SubjectStub:
|
||||||
- "**/{Formula,Casks}/*.rb"
|
|
||||||
|
|
||||||
# make our hashes consistent
|
|
||||||
Layout/HashAlignment:
|
|
||||||
EnforcedHashRocketStyle: table
|
|
||||||
EnforcedColonStyle: table
|
|
||||||
|
|
||||||
# `system` is a special case and aligns on second argument, so allow this for formulae.
|
|
||||||
Layout/ArgumentAlignment:
|
|
||||||
Exclude:
|
|
||||||
- "Taps/*/*/*.rb"
|
|
||||||
- "/**/Formula/*.rb"
|
|
||||||
- "**/Formula/*.rb"
|
|
||||||
|
|
||||||
# this is a bit less "floaty"
|
|
||||||
Layout/CaseIndentation:
|
|
||||||
EnforcedStyle: end
|
|
||||||
|
|
||||||
# Need to allow #: for external commands.
|
|
||||||
Layout/LeadingCommentSpace:
|
|
||||||
Exclude:
|
|
||||||
- "Taps/*/*/cmd/*.rb"
|
|
||||||
|
|
||||||
# this is a bit less "floaty"
|
|
||||||
Layout/EndAlignment:
|
|
||||||
EnforcedStyleAlignWith: start_of_line
|
|
||||||
|
|
||||||
# conflicts with DSL-style path concatenation with `/`
|
|
||||||
Layout/SpaceAroundOperators:
|
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
# significantly less indentation involved; more consistent
|
# TODO: try to enable these
|
||||||
Layout/FirstArrayElementIndentation:
|
RSpec/DescribeClass:
|
||||||
EnforcedStyle: consistent
|
Enabled: false
|
||||||
Layout/FirstHashElementIndentation:
|
RSpec/MessageSpies:
|
||||||
EnforcedStyle: consistent
|
Enabled: false
|
||||||
|
RSpec/StubbedMock:
|
||||||
# favour parens-less DSL-style arguments
|
|
||||||
Lint/AmbiguousBlockAssociation:
|
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
Lint/DuplicateBranch:
|
# TODO: try to reduce these
|
||||||
Exclude:
|
RSpec/ExampleLength:
|
||||||
- "Taps/*/*/*.rb"
|
Max: 75
|
||||||
- "/**/{Formula,Casks}/*.rb"
|
RSpec/MultipleExpectations:
|
||||||
- "**/{Formula,Casks}/*.rb"
|
Max: 26
|
||||||
|
RSpec/NestedGroups:
|
||||||
|
Max: 5
|
||||||
|
RSpec/MultipleMemoizedHelpers:
|
||||||
|
Max: 12
|
||||||
|
|
||||||
# so many of these in formulae and can't be autocorrected
|
# Annoying to have these autoremoved.
|
||||||
Lint/ParenthesesAsGroupedExpression:
|
RSpec/Focus:
|
||||||
Exclude:
|
AutoCorrect: false
|
||||||
- "Taps/*/*/*.rb"
|
|
||||||
- "/**/Formula/*.rb"
|
|
||||||
- "**/Formula/*.rb"
|
|
||||||
|
|
||||||
# These metrics didn't end up helping.
|
# Try getting rid of these.
|
||||||
Metrics:
|
Sorbet/ConstantsFromStrings:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
# allow those that are standard
|
|
||||||
# TODO: try to remove some of these
|
|
||||||
Naming/MethodParameterName:
|
|
||||||
inherit_mode:
|
|
||||||
merge:
|
|
||||||
- AllowedNames
|
|
||||||
AllowedNames:
|
|
||||||
- "a"
|
|
||||||
- "b"
|
|
||||||
- "cc"
|
|
||||||
- "c1"
|
|
||||||
- "c2"
|
|
||||||
- "d"
|
|
||||||
- "e"
|
|
||||||
- "f"
|
|
||||||
- "ff"
|
|
||||||
- "fn"
|
|
||||||
- "id"
|
|
||||||
- "o"
|
|
||||||
- "p"
|
|
||||||
- "pr"
|
|
||||||
- "r"
|
|
||||||
- "rb"
|
|
||||||
- "s"
|
|
||||||
- "v"
|
|
||||||
|
|
||||||
# GitHub diff UI wraps beyond 118 characters
|
|
||||||
Layout/LineLength:
|
|
||||||
Max: 118
|
|
||||||
# ignore manpage comments and long single-line strings
|
|
||||||
AllowedPatterns:
|
|
||||||
[
|
|
||||||
"#: ",
|
|
||||||
' url "',
|
|
||||||
' mirror "',
|
|
||||||
" plist_options ",
|
|
||||||
' appcast "',
|
|
||||||
' executable: "',
|
|
||||||
' font "',
|
|
||||||
' homepage "',
|
|
||||||
' name "',
|
|
||||||
' pkg "',
|
|
||||||
' pkgutil: "',
|
|
||||||
" sha256 cellar: ",
|
|
||||||
" sha256 ",
|
|
||||||
"#{language}",
|
|
||||||
"#{version.",
|
|
||||||
' "/Library/Application Support/',
|
|
||||||
'"/Library/Caches/',
|
|
||||||
'"/Library/PreferencePanes/',
|
|
||||||
' "~/Library/Application Support/',
|
|
||||||
'"~/Library/Caches/',
|
|
||||||
'"~/Application Support',
|
|
||||||
" was verified as official when first introduced to the cask",
|
|
||||||
]
|
|
||||||
|
|
||||||
Sorbet/FalseSigil:
|
Sorbet/FalseSigil:
|
||||||
Exclude:
|
Exclude:
|
||||||
- "Taps/**/*"
|
- "Taps/**/*"
|
||||||
@ -368,14 +318,22 @@ Sorbet/StrictSigil:
|
|||||||
Include:
|
Include:
|
||||||
- "**/*.rbi"
|
- "**/*.rbi"
|
||||||
|
|
||||||
# Try getting rid of these.
|
|
||||||
Sorbet/ConstantsFromStrings:
|
|
||||||
Enabled: false
|
|
||||||
|
|
||||||
# Conflicts with type signatures on `attr_*`s.
|
# Conflicts with type signatures on `attr_*`s.
|
||||||
Style/AccessorGrouping:
|
Style/AccessorGrouping:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
|
# Require &&/|| instead of and/or
|
||||||
|
Style/AndOr:
|
||||||
|
EnforcedStyle: always
|
||||||
|
|
||||||
|
# Avoid leaking resources.
|
||||||
|
Style/AutoResourceCleanup:
|
||||||
|
Enabled: true
|
||||||
|
|
||||||
|
# This makes these a little more obvious.
|
||||||
|
Style/BarePercentLiterals:
|
||||||
|
EnforcedStyle: percent_q
|
||||||
|
|
||||||
# make rspec formatting more flexible
|
# make rspec formatting more flexible
|
||||||
Style/BlockDelimiters:
|
Style/BlockDelimiters:
|
||||||
Exclude:
|
Exclude:
|
||||||
@ -387,6 +345,18 @@ Style/ClassVars:
|
|||||||
Exclude:
|
Exclude:
|
||||||
- "**/developer/bin/*"
|
- "**/developer/bin/*"
|
||||||
|
|
||||||
|
# Use consistent style for better readability.
|
||||||
|
Style/CollectionMethods:
|
||||||
|
Enabled: true
|
||||||
|
|
||||||
|
# Don't allow cops to be disabled in casks and formulae.
|
||||||
|
Style/DisableCopsWithinSourceCodeDirective:
|
||||||
|
Enabled: true
|
||||||
|
Include:
|
||||||
|
- "Taps/*/*/*.rb"
|
||||||
|
- "/**/{Formula,Casks}/*.rb"
|
||||||
|
- "**/{Formula,Casks}/*.rb"
|
||||||
|
|
||||||
# Don't enforce documentation in casks or formulae.
|
# Don't enforce documentation in casks or formulae.
|
||||||
Style/Documentation:
|
Style/Documentation:
|
||||||
Exclude:
|
Exclude:
|
||||||
@ -399,6 +369,19 @@ Style/DocumentationMethod:
|
|||||||
Include:
|
Include:
|
||||||
- "Homebrew/formula.rb"
|
- "Homebrew/formula.rb"
|
||||||
|
|
||||||
|
# This is quite a large change, so don't enforce this yet for formulae.
|
||||||
|
# We should consider doing so in the future, but be aware of the impact on third-party taps.
|
||||||
|
Style/FetchEnvVar:
|
||||||
|
Exclude:
|
||||||
|
- "Taps/*/*/*.rb"
|
||||||
|
- "/**/Formula/*.rb"
|
||||||
|
- "**/Formula/*.rb"
|
||||||
|
|
||||||
|
# Prefer tokens with type annotations for consistency
|
||||||
|
# between formatting numbers and strings.
|
||||||
|
Style/FormatStringToken:
|
||||||
|
EnforcedStyle: annotated
|
||||||
|
|
||||||
# Not used for casks and formulae.
|
# Not used for casks and formulae.
|
||||||
Style/FrozenStringLiteralComment:
|
Style/FrozenStringLiteralComment:
|
||||||
EnforcedStyle: always
|
EnforcedStyle: always
|
||||||
@ -422,10 +405,41 @@ Style/GuardClause:
|
|||||||
- "/**/{Formula,Casks}/*.rb"
|
- "/**/{Formula,Casks}/*.rb"
|
||||||
- "**/{Formula,Casks}/*.rb"
|
- "**/{Formula,Casks}/*.rb"
|
||||||
|
|
||||||
|
# Allow for license expressions
|
||||||
|
Style/HashAsLastArrayItem:
|
||||||
|
Exclude:
|
||||||
|
- "Taps/*/*/*.rb"
|
||||||
|
- "/**/Formula/*.rb"
|
||||||
|
- "**/Formula/*.rb"
|
||||||
|
|
||||||
|
# Zero-prefixed octal literals are widely used and understood.
|
||||||
|
Style/NumericLiteralPrefix:
|
||||||
|
EnforcedOctalStyle: zero_only
|
||||||
|
|
||||||
|
# Only use this for numbers >= `1_000_000`.
|
||||||
|
Style/NumericLiterals:
|
||||||
|
MinDigits: 7
|
||||||
|
Strict: true
|
||||||
|
Exclude:
|
||||||
|
- "**/Brewfile"
|
||||||
|
|
||||||
# OpenStruct is a nice helper.
|
# OpenStruct is a nice helper.
|
||||||
Style/OpenStructUse:
|
Style/OpenStructUse:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
|
# Rescuing `StandardError` is an understood default.
|
||||||
|
Style/RescueStandardError:
|
||||||
|
EnforcedStyle: implicit
|
||||||
|
|
||||||
|
# Returning `nil` is unnecessary.
|
||||||
|
Style/ReturnNil:
|
||||||
|
Enabled: true
|
||||||
|
|
||||||
|
# We have no use for using `warn` because we
|
||||||
|
# are calling Ruby with warnings disabled.
|
||||||
|
Style/StderrPuts:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
# so many of these in formulae and can't be autocorrected
|
# so many of these in formulae and can't be autocorrected
|
||||||
Style/StringConcatenation:
|
Style/StringConcatenation:
|
||||||
Exclude:
|
Exclude:
|
||||||
@ -441,10 +455,27 @@ Style/StringLiterals:
|
|||||||
Style/StringLiteralsInInterpolation:
|
Style/StringLiteralsInInterpolation:
|
||||||
EnforcedStyle: double_quotes
|
EnforcedStyle: double_quotes
|
||||||
|
|
||||||
|
# Use consistent method names.
|
||||||
|
Style/StringMethods:
|
||||||
|
Enabled: true
|
||||||
|
|
||||||
|
# An array of symbols is more readable than a symbol array
|
||||||
|
# and also allows for easier grepping.
|
||||||
|
Style/SymbolArray:
|
||||||
|
EnforcedStyle: brackets
|
||||||
|
|
||||||
# make things a bit easier to read
|
# make things a bit easier to read
|
||||||
Style/TernaryParentheses:
|
Style/TernaryParentheses:
|
||||||
EnforcedStyle: require_parentheses_when_complex
|
EnforcedStyle: require_parentheses_when_complex
|
||||||
|
|
||||||
|
# Trailing commas make diffs nicer.
|
||||||
|
Style/TrailingCommaInArguments:
|
||||||
|
EnforcedStyleForMultiline: comma
|
||||||
|
Style/TrailingCommaInArrayLiteral:
|
||||||
|
EnforcedStyleForMultiline: comma
|
||||||
|
Style/TrailingCommaInHashLiteral:
|
||||||
|
EnforcedStyleForMultiline: comma
|
||||||
|
|
||||||
# `unless ... ||` and `unless ... &&` are hard to mentally parse
|
# `unless ... ||` and `unless ... &&` are hard to mentally parse
|
||||||
Style/UnlessLogicalOperators:
|
Style/UnlessLogicalOperators:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
@ -457,7 +488,3 @@ Style/WordArray:
|
|||||||
# would rather freeze too much than too little
|
# would rather freeze too much than too little
|
||||||
Style/MutableConstant:
|
Style/MutableConstant:
|
||||||
EnforcedStyle: strict
|
EnforcedStyle: strict
|
||||||
|
|
||||||
# unused keyword arguments improve APIs
|
|
||||||
Lint/UnusedMethodArgument:
|
|
||||||
AllowUnusedKeywordArguments: true
|
|
||||||
|
@ -1,31 +0,0 @@
|
|||||||
inherit_from: ./.rubocop.yml
|
|
||||||
|
|
||||||
# Intentionally disabled as it doesn't fit with our code style.
|
|
||||||
RSpec/AnyInstance:
|
|
||||||
Enabled: false
|
|
||||||
RSpec/FilePath:
|
|
||||||
Enabled: false
|
|
||||||
RSpec/SubjectStub:
|
|
||||||
Enabled: false
|
|
||||||
|
|
||||||
# TODO: try to enable these
|
|
||||||
RSpec/DescribeClass:
|
|
||||||
Enabled: false
|
|
||||||
RSpec/MessageSpies:
|
|
||||||
Enabled: false
|
|
||||||
RSpec/StubbedMock:
|
|
||||||
Enabled: false
|
|
||||||
|
|
||||||
# TODO: try to reduce these
|
|
||||||
RSpec/ExampleLength:
|
|
||||||
Max: 75
|
|
||||||
RSpec/MultipleExpectations:
|
|
||||||
Max: 26
|
|
||||||
RSpec/NestedGroups:
|
|
||||||
Max: 5
|
|
||||||
RSpec/MultipleMemoizedHelpers:
|
|
||||||
Max: 12
|
|
||||||
|
|
||||||
# Annoying to have these autoremoved.
|
|
||||||
RSpec/Focus:
|
|
||||||
AutoCorrect: false
|
|
@ -1,5 +1,5 @@
|
|||||||
inherit_from:
|
inherit_from:
|
||||||
- ../.rubocop_rspec.yml
|
- ../.rubocop.yml
|
||||||
|
|
||||||
Homebrew/MoveToExtendOS:
|
Homebrew/MoveToExtendOS:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
@ -1,17 +1,9 @@
|
|||||||
# typed: strict
|
# typed: strict
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
# TODO: remove this (and avoid further active support in rubocops)
|
||||||
require "active_support/core_ext/array/conversions"
|
require "active_support/core_ext/array/conversions"
|
||||||
|
|
||||||
require "rubocop-performance"
|
|
||||||
require "rubocop-rails"
|
|
||||||
require "rubocop-rspec"
|
|
||||||
|
|
||||||
require_relative "../warnings"
|
|
||||||
Warnings.ignore :parser_syntax do
|
|
||||||
require "rubocop-sorbet"
|
|
||||||
end
|
|
||||||
|
|
||||||
require_relative "io_read"
|
require_relative "io_read"
|
||||||
require_relative "move_to_extend_os"
|
require_relative "move_to_extend_os"
|
||||||
require_relative "shell_commands"
|
require_relative "shell_commands"
|
||||||
|
@ -129,12 +129,7 @@ module Homebrew
|
|||||||
if files.blank? || files == [HOMEBREW_REPOSITORY]
|
if files.blank? || files == [HOMEBREW_REPOSITORY]
|
||||||
files = [HOMEBREW_LIBRARY_PATH]
|
files = [HOMEBREW_LIBRARY_PATH]
|
||||||
elsif files.none? { |f| f.to_s.start_with? HOMEBREW_LIBRARY_PATH }
|
elsif files.none? { |f| f.to_s.start_with? HOMEBREW_LIBRARY_PATH }
|
||||||
config = if files.any? { |f| (f/"spec").exist? }
|
args << "--config" << (HOMEBREW_LIBRARY/".rubocop.yml")
|
||||||
HOMEBREW_LIBRARY/".rubocop_rspec.yml"
|
|
||||||
else
|
|
||||||
HOMEBREW_LIBRARY/".rubocop.yml"
|
|
||||||
end
|
|
||||||
args << "--config" << config
|
|
||||||
end
|
end
|
||||||
|
|
||||||
args += files
|
args += files
|
||||||
|
Loading…
x
Reference in New Issue
Block a user