diff --git a/Library/.rubocop_rules.yml b/Library/.rubocop_rules.yml index 915b2e570b..c5a0018f8d 100644 --- a/Library/.rubocop_rules.yml +++ b/Library/.rubocop_rules.yml @@ -145,6 +145,7 @@ Style/MethodName: Style/PredicateName: Exclude: - 'Homebrew/compat/**/*' + NameWhitelist: is_32_bit?, is_64_bit? # `formula do` uses nested method definitions Lint/NestedMethodDefinition: diff --git a/Library/.rubocop_todo.yml b/Library/.rubocop_todo.yml index 0b29efe302..47a262a764 100644 --- a/Library/.rubocop_todo.yml +++ b/Library/.rubocop_todo.yml @@ -281,17 +281,6 @@ Style/OpMethod: - 'Homebrew/install_renamed.rb' - 'Homebrew/options.rb' -# Offense count: 4 -# Configuration parameters: NamePrefix, NamePrefixBlacklist, NameWhitelist. -# NamePrefix: is_, has_, have_ -# NamePrefixBlacklist: is_, has_, have_ -# NameWhitelist: is_a? -Style/PredicateName: - Exclude: - - 'Homebrew/compat/**/*' - - 'Homebrew/download_strategy.rb' - - 'Homebrew/hardware.rb' - # Offense count: 7 # Cop supports --auto-correct. # Configuration parameters: EnforcedStyle, SupportedStyles, AllowInnerSlashes. diff --git a/Library/Homebrew/cask/.rubocop.yml b/Library/Homebrew/cask/.rubocop.yml index 08696fdb84..076b87f61f 100644 --- a/Library/Homebrew/cask/.rubocop.yml +++ b/Library/Homebrew/cask/.rubocop.yml @@ -115,9 +115,6 @@ Style/PercentLiteralDelimiters: '%W': '[]' '%x': '()' -Style/PredicateName: - NameWhitelist: is_32_bit?, is_64_bit? - Style/RaiseArgs: EnforcedStyle: exploded diff --git a/Library/Homebrew/download_strategy.rb b/Library/Homebrew/download_strategy.rb index 2762f01b00..d19d131a75 100644 --- a/Library/Homebrew/download_strategy.rb +++ b/Library/Homebrew/download_strategy.rb @@ -663,7 +663,7 @@ class GitDownloadStrategy < VCSDownloadStrategy @shallow && support_depth? end - def is_shallow_clone? + def shallow_dir? git_dir.join("shallow").exist? end @@ -675,7 +675,7 @@ class GitDownloadStrategy < VCSDownloadStrategy cached_location.join(".git") end - def has_ref? + def ref? quiet_system "git", "--git-dir", git_dir, "rev-parse", "-q", "--verify", "#{@ref}^{commit}" end @@ -717,8 +717,8 @@ class GitDownloadStrategy < VCSDownloadStrategy end def update_repo - if @ref_type == :branch || !has_ref? - if !shallow_clone? && is_shallow_clone? + if @ref_type == :branch || !ref? + if !shallow_clone? && shallow_dir? quiet_safe_system "git", "fetch", "origin", "--unshallow" else quiet_safe_system "git", "fetch", "origin"