Skip to content

Commit

Permalink
More Formula/Casks sharding fixes
Browse files Browse the repository at this point in the history
- Stop `brew style` from complaining
- Fix message reference in `brew edit`
  • Loading branch information
MikeMcQuaid committed Feb 27, 2023
1 parent a7a3eca commit d1f2690
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 42 deletions.
101 changes: 60 additions & 41 deletions Library/.rubocop.yml
Expand Up @@ -63,9 +63,9 @@ Homebrew/MoveToExtendOS:
# `system` is a special case and aligns on second argument, so allow this for formulae.
Layout/ArgumentAlignment:
Exclude:
- "Taps/*/*/*.rb"
- "/**/Formula/*.rb"
- "**/Formula/*.rb"
- "Taps/**/*.rb"
- "/**/Formula/**/*.rb"
- "**/Formula/**/*.rb"

# this is a bit less "floaty"
Layout/CaseIndentation:
Expand Down Expand Up @@ -129,26 +129,26 @@ Layout/SpaceAroundOperators:
Layout/SpaceBeforeBrackets:
Exclude:
- "**/*_spec.rb"
- "Taps/*/*/*.rb"
- "/**/{Formula,Casks}/*.rb"
- "**/{Formula,Casks}/*.rb"
- "Taps/**/*.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"
- "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"
- "Taps/**/*.rb"
- "/**/Formula/**/*.rb"
- "**/Formula/**/*.rb"

# unused keyword arguments improve APIs
Lint/UnusedMethodArgument:
Expand All @@ -173,11 +173,11 @@ Naming/InclusiveLanguage:
# TODO: If possible, make this stricter.
slave:
AllowedRegex:
- "gitslave" # Used in formula `gitslave`
- "log_slave" # Used in formula `ssdb`
- "ssdb_slave" # Used in formula `ssdb`
- "var_slave" # Used in formula `ssdb`
- "patches/13_fix_scope_for_show_slave_status_data.patch" # Used in formula `mytop`
- "gitslave" # Used in formula `gitslave`
- "log_slave" # Used in formula `ssdb`
- "ssdb_slave" # Used in formula `ssdb`
- "var_slave" # Used in formula `ssdb`
- "patches/13_fix_scope_for_show_slave_status_data.patch" # Used in formula `mytop`

Naming/MethodName:
AllowedPatterns:
Expand All @@ -189,7 +189,27 @@ 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"]
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,
# e.g. `sha256` and `something_countable_1`.
Expand Down Expand Up @@ -223,7 +243,7 @@ Rails/Blank:
Rails/CompactBlank:
Enabled: true
Rails/Delegate:
Enabled: false # TODO
Enabled: false # TODO
Rails/DelegateAllowBlank:
Enabled: true
Rails/DurationArithmetic:
Expand Down Expand Up @@ -288,8 +308,8 @@ Sorbet/ConstantsFromStrings:
Sorbet/FalseSigil:
Exclude:
- "Taps/**/*"
- "/**/{Formula,Casks}/*.rb"
- "**/{Formula,Casks}/*.rb"
- "/**/{Formula,Casks}/**/*.rb"
- "**/{Formula,Casks}/**/*.rb"
- "Homebrew/test/**/Casks/**/*.rb"

Sorbet/StrictSigil:
Expand Down Expand Up @@ -335,16 +355,15 @@ Style/CollectionMethods:
Style/DisableCopsWithinSourceCodeDirective:
Enabled: true
Include:
- "Taps/*/*/*.rb"
- "/**/{Formula,Casks}/*.rb"
- "**/{Formula,Casks}/*.rb"
- "/**/{Formula,Casks}/**/*.rb"
- "**/{Formula,Casks}/**/*.rb"

# Don't enforce documentation in casks or formulae.
Style/Documentation:
Exclude:
- "Taps/**/*"
- "/**/{Formula,Casks}/*.rb"
- "**/{Formula,Casks}/*.rb"
- "/**/{Formula,Casks}/**/*.rb"
- "**/{Formula,Casks}/**/*.rb"
- "**/*.rbi"

Style/DocumentationMethod:
Expand All @@ -355,9 +374,9 @@ Style/DocumentationMethod:
# 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"
- "Taps/**/*.rb"
- "/**/Formula/**/*.rb"
- "**/Formula/**/*.rb"

# Prefer tokens with type annotations for consistency
# between formatting numbers and strings.
Expand All @@ -368,9 +387,9 @@ Style/FormatStringToken:
Style/FrozenStringLiteralComment:
EnforcedStyle: always
Exclude:
- "Taps/*/*/*.rb"
- "/**/{Formula,Casks}/*.rb"
- "**/{Formula,Casks}/*.rb"
- "Taps/**/*.rb"
- "/**/{Formula,Casks}/**/*.rb"
- "**/{Formula,Casks}/**/*.rb"
- "Homebrew/test/**/Casks/**/*.rb"
- "**/*.rbi"
- "**/Brewfile"
Expand All @@ -383,16 +402,16 @@ Style/GlobalVars:
# potential for errors in formulae too high with this
Style/GuardClause:
Exclude:
- "Taps/*/*/*.rb"
- "/**/{Formula,Casks}/*.rb"
- "**/{Formula,Casks}/*.rb"
- "Taps/**/*.rb"
- "/**/{Formula,Casks}/**/*.rb"
- "**/{Formula,Casks}/**/*.rb"

# Allow for license expressions
Style/HashAsLastArrayItem:
Exclude:
- "Taps/*/*/*.rb"
- "/**/Formula/*.rb"
- "**/Formula/*.rb"
- "Taps/**/*.rb"
- "/**/Formula/**/*.rb"
- "**/Formula/**/*.rb"

# Zero-prefixed octal literals are widely used and understood.
Style/NumericLiteralPrefix:
Expand Down Expand Up @@ -425,9 +444,9 @@ Style/StderrPuts:
# so many of these in formulae and can't be autocorrected
Style/StringConcatenation:
Exclude:
- "Taps/*/*/*.rb"
- "/**/{Formula,Casks}/*.rb"
- "**/{Formula,Casks}/*.rb"
- "Taps/**/*.rb"
- "/**/{Formula,Casks}/**/*.rb"
- "**/{Formula,Casks}/**/*.rb"

# ruby style guide favorite
Style/StringLiterals:
Expand Down
2 changes: 1 addition & 1 deletion Library/Homebrew/dev-cmd/edit.rb
Expand Up @@ -81,7 +81,7 @@ def edit
if Homebrew::EnvConfig.automatically_set_no_install_from_api? &&
!Homebrew::EnvConfig.no_env_hints?
paths.each do |path|
next if !path.fnmatch?("**/homebrew-core/Formula/*.rb") && !path.fnmatch?("**/homebrew-cask/Casks/*.rb")
next if !path.fnmatch?("**/homebrew-core/Formula/**/*.rb") && !path.fnmatch?("**/homebrew-cask/Casks/**/*.rb")

opoo <<~EOS
Unless `HOMEBREW_NO_INSTALL_FROM_API` is set when running
Expand Down

0 comments on commit d1f2690

Please sign in to comment.