Code review changes
This commit is contained in:
parent
3abbf4447e
commit
caf8259ae6
@ -843,7 +843,7 @@ module Cask
|
||||
def bad_url_format?(regex, valid_formats_array)
|
||||
return false unless cask.url.to_s.match?(regex)
|
||||
|
||||
valid_formats_array.none? { |format| cask.url.to_s&.match?(format) }
|
||||
valid_formats_array.none? { |format| cask.url.to_s.match?(format) }
|
||||
end
|
||||
|
||||
sig { returns(T::Boolean) }
|
||||
|
||||
@ -294,7 +294,7 @@ module Homebrew
|
||||
|
||||
# Ignore matches to go keg, because all go binaries are statically linked.
|
||||
any_go_deps = formula.deps.any? do |dep|
|
||||
dep.name&.match?(Version.formula_optionally_versioned_regex(:go))
|
||||
Version.formula_optionally_versioned_regex(:go).match?(dep.name)
|
||||
end
|
||||
if any_go_deps
|
||||
go_regex = Version.formula_optionally_versioned_regex(:go, full: false)
|
||||
|
||||
@ -32,12 +32,12 @@ module Homebrew
|
||||
end
|
||||
|
||||
def line_number(regex, skip = 0)
|
||||
index = @lines.drop(skip).index { |line| line&.match?(regex) }
|
||||
index = @lines.drop(skip).index { |line| line.match?(regex) }
|
||||
index ? index + 1 : nil
|
||||
end
|
||||
|
||||
def reverse_line_number(regex)
|
||||
index = @lines.reverse.index { |line| line&.match?(regex) }
|
||||
index = @lines.reverse.index { |line| line.match?(regex) }
|
||||
index ? @lines.count - index : nil
|
||||
end
|
||||
end
|
||||
|
||||
@ -328,7 +328,7 @@ class Keg
|
||||
Utils.popen_read("strings", "-t", "x", "-", file.to_s) do |io|
|
||||
until io.eof?
|
||||
str = io.readline.chomp
|
||||
next if ignores.any? { |i| i&.match?(str) }
|
||||
next if ignores.any? { |i| str.match?(i) }
|
||||
next unless str.match? path_regex
|
||||
|
||||
offset, match = str.split(" ", 2)
|
||||
|
||||
@ -66,7 +66,7 @@ module Homebrew
|
||||
|
||||
# Isolate tag strings and filter by regex
|
||||
tags = stdout.gsub(%r{^.*\trefs/tags/|\^{}$}, "").split("\n").uniq.sort
|
||||
tags.select! { |t| t&.match?(regex) } if regex
|
||||
tags.select! { |t| regex.match?(t) } if regex
|
||||
tags_data[:tags] = tags
|
||||
|
||||
tags_data
|
||||
|
||||
@ -233,7 +233,7 @@ module RuboCop
|
||||
paths_to_exclude = [%r{/Library/Homebrew/test/}]
|
||||
return true if @file_path.nil? # file_path is nil when source is directly passed to the cop, e.g. in specs
|
||||
|
||||
!@file_path&.match?(Regexp.union(paths_to_exclude))
|
||||
!@file_path.match?(Regexp.union(paths_to_exclude))
|
||||
end
|
||||
|
||||
def on_system_methods
|
||||
|
||||
@ -5,7 +5,7 @@ require "cask/audit"
|
||||
describe Cask::Audit, :cask do
|
||||
def include_msg?(problems, msg)
|
||||
if msg.is_a?(Regexp)
|
||||
Array(problems).any? { |problem| problem[:message]&.match?(msg) }
|
||||
Array(problems).any? { |problem| msg.match?(problem[:message]) }
|
||||
else
|
||||
Array(problems).any? { |problem| problem[:message] == msg }
|
||||
end
|
||||
|
||||
@ -335,7 +335,7 @@ module Utils
|
||||
# Strategy:
|
||||
# If the `:homepage` 404s, it's a GitHub link, and we have a token then
|
||||
# check the API (which does use tokens) for the repository
|
||||
repo_details = url.match?(%r{https?://github\.com/(?<user>[^/]+)/(?<repo>[^/]+)/?.*})
|
||||
repo_details = url.match(%r{https?://github\.com/(?<user>[^/]+)/(?<repo>[^/]+)/?.*})
|
||||
check_github_api = url_type == SharedAudits::URL_TYPE_HOMEPAGE &&
|
||||
details[:status_code] == "404" &&
|
||||
repo_details &&
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user