mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00
brew style --fix
This commit is contained in:
parent
edc6107ccb
commit
aa81982aba
@ -259,7 +259,7 @@ module Cask
|
|||||||
bad_url_format?(/sourceforge/,
|
bad_url_format?(/sourceforge/,
|
||||||
[
|
[
|
||||||
%r{\Ahttps://sourceforge\.net/projects/[^/]+/files/latest/download\Z},
|
%r{\Ahttps://sourceforge\.net/projects/[^/]+/files/latest/download\Z},
|
||||||
%r{\Ahttps://downloads\.sourceforge\.net/(?!(project|sourceforge)\/)},
|
%r{\Ahttps://downloads\.sourceforge\.net/(?!(project|sourceforge)/)},
|
||||||
])
|
])
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@ module Cask
|
|||||||
module Blacklist
|
module Blacklist
|
||||||
def self.blacklisted_reason(name)
|
def self.blacklisted_reason(name)
|
||||||
case name
|
case name
|
||||||
when /^adobe\-(after|illustrator|indesign|photoshop|premiere)/
|
when /^adobe-(after|illustrator|indesign|photoshop|premiere)/
|
||||||
"Adobe casks were removed because they are too difficult to maintain."
|
"Adobe casks were removed because they are too difficult to maintain."
|
||||||
when /^audacity$/
|
when /^audacity$/
|
||||||
"Audacity was removed because it is too difficult to download programmatically."
|
"Audacity was removed because it is too difficult to download programmatically."
|
||||||
|
@ -180,7 +180,7 @@ module Cask
|
|||||||
end
|
end
|
||||||
|
|
||||||
def process_options(*args)
|
def process_options(*args)
|
||||||
exclude_regex = /^\-\-#{Regexp.union(*Config::DEFAULT_DIRS.keys.map(&Regexp.public_method(:escape)))}=/
|
exclude_regex = /^--#{Regexp.union(*Config::DEFAULT_DIRS.keys.map(&Regexp.public_method(:escape)))}=/
|
||||||
|
|
||||||
non_options = []
|
non_options = []
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@ module Cask
|
|||||||
next if self.class.options.nil?
|
next if self.class.options.nil?
|
||||||
|
|
||||||
self.class.options.each do |option_name, option_method|
|
self.class.options.each do |option_name, option_method|
|
||||||
option_type = case option_name.split(/(\ |\=)/).last
|
option_type = case option_name.split(/(\ |=)/).last
|
||||||
when "PATH"
|
when "PATH"
|
||||||
Pathname
|
Pathname
|
||||||
when /\w+(,\w+)+/
|
when /\w+(,\w+)+/
|
||||||
|
@ -86,7 +86,7 @@ module Cask
|
|||||||
Shellwords.shellsplit(ENV.fetch("HOMEBREW_CASK_OPTS", ""))
|
Shellwords.shellsplit(ENV.fetch("HOMEBREW_CASK_OPTS", ""))
|
||||||
.select { |arg| arg.include?("=") }
|
.select { |arg| arg.include?("=") }
|
||||||
.map { |arg| arg.split("=", 2) }
|
.map { |arg| arg.split("=", 2) }
|
||||||
.map { |(flag, value)| [flag.sub(/^\-\-/, ""), value] },
|
.map { |(flag, value)| [flag.sub(/^--/, ""), value] },
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -11,9 +11,9 @@ module Cask
|
|||||||
|
|
||||||
DIVIDER_REGEX = /(#{DIVIDERS.keys.map { |v| Regexp.quote(v) }.join('|')})/.freeze
|
DIVIDER_REGEX = /(#{DIVIDERS.keys.map { |v| Regexp.quote(v) }.join('|')})/.freeze
|
||||||
|
|
||||||
MAJOR_MINOR_PATCH_REGEX = /^([^.,:]+)(?:\.([^.,:]+)(?:\.([^.,:]+))?)?/.freeze
|
MAJOR_MINOR_PATCH_REGEX = /^([^.,:]+)(?:.([^.,:]+)(?:.([^.,:]+))?)?/.freeze
|
||||||
|
|
||||||
INVALID_CHARACTERS = /[^0-9a-zA-Z\.\,\:\-\_]/.freeze
|
INVALID_CHARACTERS = /[^0-9a-zA-Z.,:\-_]/.freeze
|
||||||
|
|
||||||
class << self
|
class << self
|
||||||
private
|
private
|
||||||
@ -75,7 +75,7 @@ module Cask
|
|||||||
s = downcase.delete(".").gsub(/[^a-z\d]+/, "-")
|
s = downcase.delete(".").gsub(/[^a-z\d]+/, "-")
|
||||||
|
|
||||||
return true if s.match?(/(\d+|\b)(alpha|beta|preview|rc|dev|canary|snapshot)(\d+|\b)/i)
|
return true if s.match?(/(\d+|\b)(alpha|beta|preview|rc|dev|canary|snapshot)(\d+|\b)/i)
|
||||||
return true if s.match?(/\A[a-z\d]+(\-\d+)*\-?(a|b|pre)(\d+|\b)/i)
|
return true if s.match?(/\A[a-z\d]+(-\d+)*-?(a|b|pre)(\d+|\b)/i)
|
||||||
|
|
||||||
false
|
false
|
||||||
end
|
end
|
||||||
|
@ -56,14 +56,14 @@ module CleanupRefinement
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
version ||= basename.to_s[/\A.*(?:\-\-.*?)*\-\-(.*?)#{Regexp.escape(extname)}\Z/, 1]
|
version ||= basename.to_s[/\A.*(?:--.*?)*--(.*?)#{Regexp.escape(extname)}\Z/, 1]
|
||||||
version ||= basename.to_s[/\A.*\-\-?(.*?)#{Regexp.escape(extname)}\Z/, 1]
|
version ||= basename.to_s[/\A.*--?(.*?)#{Regexp.escape(extname)}\Z/, 1]
|
||||||
|
|
||||||
return false unless version
|
return false unless version
|
||||||
|
|
||||||
version = Version.new(version)
|
version = Version.new(version)
|
||||||
|
|
||||||
return false unless formula_name = basename.to_s[/\A(.*?)(?:\-\-.*?)*\-\-?(?:#{Regexp.escape(version)})/, 1]
|
return false unless formula_name = basename.to_s[/\A(.*?)(?:--.*?)*--?(?:#{Regexp.escape(version)})/, 1]
|
||||||
|
|
||||||
formula = begin
|
formula = begin
|
||||||
Formulary.from_rack(HOMEBREW_CELLAR/formula_name)
|
Formulary.from_rack(HOMEBREW_CELLAR/formula_name)
|
||||||
@ -71,7 +71,7 @@ module CleanupRefinement
|
|||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
resource_name = basename.to_s[/\A.*?\-\-(.*?)\-\-?(?:#{Regexp.escape(version)})/, 1]
|
resource_name = basename.to_s[/\A.*?--(.*?)--?(?:#{Regexp.escape(version)})/, 1]
|
||||||
|
|
||||||
if resource_name == "patch"
|
if resource_name == "patch"
|
||||||
patch_hashes = formula.stable&.patches&.select(&:external?)&.map(&:resource)&.map(&:version)
|
patch_hashes = formula.stable&.patches&.select(&:external?)&.map(&:resource)&.map(&:version)
|
||||||
@ -92,7 +92,7 @@ module CleanupRefinement
|
|||||||
end
|
end
|
||||||
|
|
||||||
def stale_cask?(scrub)
|
def stale_cask?(scrub)
|
||||||
return false unless name = basename.to_s[/\A(.*?)\-\-/, 1]
|
return false unless name = basename.to_s[/\A(.*?)--/, 1]
|
||||||
|
|
||||||
cask = begin
|
cask = begin
|
||||||
Cask::CaskLoader.load(name)
|
Cask::CaskLoader.load(name)
|
||||||
@ -100,7 +100,7 @@ module CleanupRefinement
|
|||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
return true unless basename.to_s.match?(/\A#{Regexp.escape(name)}\-\-#{Regexp.escape(cask.version)}\b/)
|
return true unless basename.to_s.match?(/\A#{Regexp.escape(name)}--#{Regexp.escape(cask.version)}\b/)
|
||||||
|
|
||||||
return true if scrub && !cask.versions.include?(cask.version)
|
return true if scrub && !cask.versions.include?(cask.version)
|
||||||
|
|
||||||
|
@ -669,7 +669,7 @@ module Homebrew
|
|||||||
.map(&:to_i)
|
.map(&:to_i)
|
||||||
|
|
||||||
case (url = stable.url)
|
case (url = stable.url)
|
||||||
when /[\d\._-](alpha|beta|rc\d)/
|
when /[\d._-](alpha|beta|rc\d)/
|
||||||
matched = Regexp.last_match(1)
|
matched = Regexp.last_match(1)
|
||||||
version_prefix = stable_version_string.sub(/\d+$/, "")
|
version_prefix = stable_version_string.sub(/\d+$/, "")
|
||||||
return if UNSTABLE_WHITELIST[formula.name] == version_prefix
|
return if UNSTABLE_WHITELIST[formula.name] == version_prefix
|
||||||
@ -803,7 +803,7 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
bin_names.each do |name|
|
bin_names.each do |name|
|
||||||
["system", "shell_output", "pipe_output"].each do |cmd|
|
["system", "shell_output", "pipe_output"].each do |cmd|
|
||||||
if text.to_s.match?(/test do.*#{cmd}[\(\s]+['"]#{Regexp.escape(name)}[\s'"]/m)
|
if text.to_s.match?(/test do.*#{cmd}[(\s]+['"]#{Regexp.escape(name)}[\s'"]/m)
|
||||||
problem %Q(fully scope test #{cmd} calls, e.g. #{cmd} "\#{bin}/#{name}")
|
problem %Q(fully scope test #{cmd} calls, e.g. #{cmd} "\#{bin}/#{name}")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -321,7 +321,7 @@ module Homebrew
|
|||||||
if any_go_deps
|
if any_go_deps
|
||||||
go_regex =
|
go_regex =
|
||||||
Version.formula_optionally_versioned_regex(:go, full: false)
|
Version.formula_optionally_versioned_regex(:go, full: false)
|
||||||
ignores << %r{#{Regexp.escape(HOMEBREW_CELLAR)}/#{go_regex}/[\d\.]+/libexec}
|
ignores << %r{#{Regexp.escape(HOMEBREW_CELLAR)}/#{go_regex}/[\d.]+/libexec}
|
||||||
end
|
end
|
||||||
|
|
||||||
relocatable = true
|
relocatable = true
|
||||||
|
@ -79,7 +79,7 @@ module Homebrew
|
|||||||
origin_branch = "#{homebrew_core_remote}/#{homebrew_core_branch}"
|
origin_branch = "#{homebrew_core_remote}/#{homebrew_core_branch}"
|
||||||
previous_branch = Utils.popen_read("git -C \"#{formula.tap.path}\" symbolic-ref -q --short HEAD").chomp
|
previous_branch = Utils.popen_read("git -C \"#{formula.tap.path}\" symbolic-ref -q --short HEAD").chomp
|
||||||
previous_branch = "master" if previous_branch.empty?
|
previous_branch = "master" if previous_branch.empty?
|
||||||
formula_path = formula.path.to_s[%r{(Formula\/.*)}, 1]
|
formula_path = formula.path.to_s[%r{(Formula/.*)}, 1]
|
||||||
|
|
||||||
if args.dry_run?
|
if args.dry_run?
|
||||||
ohai "git remote add #{homebrew_core_remote} #{homebrew_core_url}"
|
ohai "git remote add #{homebrew_core_remote} #{homebrew_core_url}"
|
||||||
@ -89,7 +89,7 @@ module Homebrew
|
|||||||
return tap_full_name, origin_branch, previous_branch
|
return tap_full_name, origin_branch, previous_branch
|
||||||
else
|
else
|
||||||
formula.path.parent.cd do
|
formula.path.parent.cd do
|
||||||
unless Utils.popen_read("git remote -v").match?(%r{^homebrew.*Homebrew\/homebrew-core.*$})
|
unless Utils.popen_read("git remote -v").match?(%r{^homebrew.*Homebrew/homebrew-core.*$})
|
||||||
ohai "Adding #{homebrew_core_remote} remote"
|
ohai "Adding #{homebrew_core_remote} remote"
|
||||||
safe_system "git", "remote", "add", homebrew_core_remote, homebrew_core_url
|
safe_system "git", "remote", "add", homebrew_core_remote, homebrew_core_url
|
||||||
end
|
end
|
||||||
@ -225,7 +225,7 @@ module Homebrew
|
|||||||
|
|
||||||
replacement_pairs += formula_spec.mirrors.map do |mirror|
|
replacement_pairs += formula_spec.mirrors.map do |mirror|
|
||||||
[
|
[
|
||||||
/ +mirror \"#{Regexp.escape(mirror)}\"\n/m,
|
/ +mirror "#{Regexp.escape(mirror)}"\n/m,
|
||||||
"",
|
"",
|
||||||
]
|
]
|
||||||
end
|
end
|
||||||
@ -258,7 +258,7 @@ module Homebrew
|
|||||||
|
|
||||||
if new_mirrors
|
if new_mirrors
|
||||||
replacement_pairs << [
|
replacement_pairs << [
|
||||||
/^( +)(url \"#{Regexp.escape(new_url)}\"\n)/m,
|
/^( +)(url "#{Regexp.escape(new_url)}"\n)/m,
|
||||||
"\\1\\2\\1mirror \"#{new_mirrors.join("\"\n\\1mirror \"")}\"\n",
|
"\\1\\2\\1mirror \"#{new_mirrors.join("\"\n\\1mirror \"")}\"\n",
|
||||||
]
|
]
|
||||||
end
|
end
|
||||||
@ -283,30 +283,30 @@ module Homebrew
|
|||||||
]
|
]
|
||||||
elsif new_mirrors
|
elsif new_mirrors
|
||||||
[
|
[
|
||||||
/^( +)(mirror \"#{Regexp.escape(new_mirrors.last)}\"\n)/m,
|
/^( +)(mirror "#{Regexp.escape(new_mirrors.last)}"\n)/m,
|
||||||
"\\1\\2\\1version \"#{forced_version}\"\n",
|
"\\1\\2\\1version \"#{forced_version}\"\n",
|
||||||
]
|
]
|
||||||
else
|
else
|
||||||
[
|
[
|
||||||
/^( +)(url \"#{Regexp.escape(new_url)}\"\n)/m,
|
/^( +)(url "#{Regexp.escape(new_url)}"\n)/m,
|
||||||
"\\1\\2\\1version \"#{forced_version}\"\n",
|
"\\1\\2\\1version \"#{forced_version}\"\n",
|
||||||
]
|
]
|
||||||
end
|
end
|
||||||
elsif requested_spec == :devel
|
elsif requested_spec == :devel
|
||||||
replacement_pairs << [
|
replacement_pairs << [
|
||||||
/( devel do.+?version \")#{old_formula_version}(\"\n.+?end\n)/m,
|
/( devel do.+?version ")#{old_formula_version}("\n.+?end\n)/m,
|
||||||
"\\1#{forced_version}\\2",
|
"\\1#{forced_version}\\2",
|
||||||
]
|
]
|
||||||
end
|
end
|
||||||
elsif forced_version && forced_version == "0"
|
elsif forced_version && forced_version == "0"
|
||||||
if requested_spec == :stable
|
if requested_spec == :stable
|
||||||
replacement_pairs << [
|
replacement_pairs << [
|
||||||
/^ version \"[\w\.\-\+]+\"\n/m,
|
/^ version "[\w.\-+]+"\n/m,
|
||||||
"",
|
"",
|
||||||
]
|
]
|
||||||
elsif requested_spec == :devel
|
elsif requested_spec == :devel
|
||||||
replacement_pairs << [
|
replacement_pairs << [
|
||||||
/( devel do.+?)^ +version \"[^\n]+\"\n(.+?end\n)/m,
|
/( devel do.+?)^ +version "[^\n]+"\n(.+?end\n)/m,
|
||||||
"\\1\\2",
|
"\\1\\2",
|
||||||
]
|
]
|
||||||
end
|
end
|
||||||
|
@ -333,7 +333,7 @@ module Homebrew
|
|||||||
|
|
||||||
def check_bintray_mirror(name, url)
|
def check_bintray_mirror(name, url)
|
||||||
headers, = curl_output("--connect-timeout", "15", "--location", "--head", url)
|
headers, = curl_output("--connect-timeout", "15", "--location", "--head", url)
|
||||||
status_code = headers.scan(%r{^HTTP\/.* (\d+)}).last.first
|
status_code = headers.scan(%r{^HTTP/.* (\d+)}).last.first
|
||||||
return if status_code.start_with?("2")
|
return if status_code.start_with?("2")
|
||||||
|
|
||||||
opoo "The Bintray mirror #{url} is not reachable (HTTP status code #{status_code})."
|
opoo "The Bintray mirror #{url} is not reachable (HTTP status code #{status_code})."
|
||||||
|
@ -221,7 +221,7 @@ class AbstractFileDownloadStrategy < AbstractDownloadStrategy
|
|||||||
end
|
end
|
||||||
|
|
||||||
def basename
|
def basename
|
||||||
cached_location.basename.sub(/^[\da-f]{64}\-\-/, "")
|
cached_location.basename.sub(/^[\da-f]{64}--/, "")
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
@ -390,7 +390,7 @@ class CurlDownloadStrategy < AbstractFileDownloadStrategy
|
|||||||
filenames = lines.map(&parse_content_disposition).compact
|
filenames = lines.map(&parse_content_disposition).compact
|
||||||
|
|
||||||
time =
|
time =
|
||||||
lines.map { |line| line[/^Last\-Modified:\s*(.+)/i, 1] }
|
lines.map { |line| line[/^Last-Modified:\s*(.+)/i, 1] }
|
||||||
.compact
|
.compact
|
||||||
.map { |t| t.match?(/^\d+$/) ? Time.at(t.to_i) : Time.parse(t) }
|
.map { |t| t.match?(/^\d+$/) ? Time.at(t.to_i) : Time.parse(t) }
|
||||||
.last
|
.last
|
||||||
@ -820,7 +820,7 @@ class GitHubGitDownloadStrategy < GitDownloadStrategy
|
|||||||
|
|
||||||
return unless status.success?
|
return unless status.success?
|
||||||
|
|
||||||
commit = output[/^ETag: \"(\h+)\"/, 1]
|
commit = output[/^ETag: "(\h+)"/, 1]
|
||||||
version.update_commit(commit) if commit
|
version.update_commit(commit) if commit
|
||||||
commit
|
commit
|
||||||
end
|
end
|
||||||
|
@ -224,7 +224,7 @@ class Pathname
|
|||||||
return archive_ext if archive_ext
|
return archive_ext if archive_ext
|
||||||
|
|
||||||
# Don't treat version numbers as extname.
|
# Don't treat version numbers as extname.
|
||||||
return "" if basename.match?(/\b\d+\.\d+[^\.]*\Z/) && !basename.end_with?(".7z")
|
return "" if basename.match?(/\b\d+\.\d+[^.]*\Z/) && !basename.end_with?(".7z")
|
||||||
|
|
||||||
File.extname(basename)
|
File.extname(basename)
|
||||||
end
|
end
|
||||||
|
@ -26,7 +26,7 @@ module StringInreplaceExtension
|
|||||||
# Looks for Makefile style variable definitions and replaces the
|
# Looks for Makefile style variable definitions and replaces the
|
||||||
# value with "new_value", or removes the definition entirely.
|
# value with "new_value", or removes the definition entirely.
|
||||||
def change_make_var!(flag, new_value)
|
def change_make_var!(flag, new_value)
|
||||||
return if gsub!(/^#{Regexp.escape(flag)}[ \t]*[\\?\+\:\!]?=[ \t]*((?:.*\\\n)*.*)$/, "#{flag}=#{new_value}", false)
|
return if gsub!(/^#{Regexp.escape(flag)}[ \t]*[\\?+:!]?=[ \t]*((?:.*\\\n)*.*)$/, "#{flag}=#{new_value}", false)
|
||||||
|
|
||||||
errors << "expected to change #{flag.inspect} to #{new_value.inspect}"
|
errors << "expected to change #{flag.inspect} to #{new_value.inspect}"
|
||||||
end
|
end
|
||||||
@ -35,7 +35,7 @@ module StringInreplaceExtension
|
|||||||
def remove_make_var!(flags)
|
def remove_make_var!(flags)
|
||||||
Array(flags).each do |flag|
|
Array(flags).each do |flag|
|
||||||
# Also remove trailing \n, if present.
|
# Also remove trailing \n, if present.
|
||||||
unless gsub!(/^#{Regexp.escape(flag)}[ \t]*[\\?\+\:\!]?=(?:.*\\\n)*.*$\n?/, "", false)
|
unless gsub!(/^#{Regexp.escape(flag)}[ \t]*[\\?+:!]?=(?:.*\\\n)*.*$\n?/, "", false)
|
||||||
errors << "expected to remove #{flag.inspect}"
|
errors << "expected to remove #{flag.inspect}"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -43,6 +43,6 @@ module StringInreplaceExtension
|
|||||||
|
|
||||||
# Finds the specified variable
|
# Finds the specified variable
|
||||||
def get_make_var(flag)
|
def get_make_var(flag)
|
||||||
self[/^#{Regexp.escape(flag)}[ \t]*[\\?\+\:\!]?=[ \t]*((?:.*\\\n)*.*)$/, 1]
|
self[/^#{Regexp.escape(flag)}[ \t]*[\\?+:!]?=[ \t]*((?:.*\\\n)*.*)$/, 1]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -8,7 +8,7 @@ class Locale
|
|||||||
REGION_REGEX = /(?:[A-Z]{2}|\d{3})/.freeze # ISO 3166-1 or UN M.49
|
REGION_REGEX = /(?:[A-Z]{2}|\d{3})/.freeze # ISO 3166-1 or UN M.49
|
||||||
SCRIPT_REGEX = /(?:[A-Z][a-z]{3})/.freeze # ISO 15924
|
SCRIPT_REGEX = /(?:[A-Z][a-z]{3})/.freeze # ISO 15924
|
||||||
|
|
||||||
LOCALE_REGEX = /\A((?:#{LANGUAGE_REGEX}|#{REGION_REGEX}|#{SCRIPT_REGEX})(?:\-|$)){1,3}\Z/.freeze
|
LOCALE_REGEX = /\A((?:#{LANGUAGE_REGEX}|#{REGION_REGEX}|#{SCRIPT_REGEX})(?:-|$)){1,3}\Z/.freeze
|
||||||
|
|
||||||
def self.parse(string)
|
def self.parse(string)
|
||||||
string = string.to_s
|
string = string.to_s
|
||||||
@ -16,7 +16,7 @@ class Locale
|
|||||||
raise ParserError, "'#{string}' cannot be parsed to a #{self}" unless string.match?(LOCALE_REGEX)
|
raise ParserError, "'#{string}' cannot be parsed to a #{self}" unless string.match?(LOCALE_REGEX)
|
||||||
|
|
||||||
scan = proc do |regex|
|
scan = proc do |regex|
|
||||||
string.scan(/(?:\-|^)(#{regex})(?:\-|$)/).flatten.first
|
string.scan(/(?:-|^)(#{regex})(?:-|$)/).flatten.first
|
||||||
end
|
end
|
||||||
|
|
||||||
language = scan.call(LANGUAGE_REGEX)
|
language = scan.call(LANGUAGE_REGEX)
|
||||||
|
@ -129,7 +129,7 @@ module RuboCop
|
|||||||
string = stanza.stanza_node.children[2]
|
string = stanza.stanza_node.children[2]
|
||||||
return string.str_content if string.str_type?
|
return string.str_content if string.str_type?
|
||||||
|
|
||||||
string.to_s.gsub(%r{.*"([a-z0-9]+\:\/\/[^"]+)".*}m, '\1')
|
string.to_s.gsub(%r{.*"([a-z0-9]+://[^"]+)".*}m, '\1')
|
||||||
end
|
end
|
||||||
|
|
||||||
def url_match_homepage?(stanza)
|
def url_match_homepage?(stanza)
|
||||||
|
@ -153,7 +153,7 @@ module RuboCop
|
|||||||
|
|
||||||
find_instance_method_call(body_node, :build, :include?) do |method|
|
find_instance_method_call(body_node, :build, :include?) do |method|
|
||||||
arg = parameters(method).first
|
arg = parameters(method).first
|
||||||
next unless match = regex_match_group(arg, /^\-\-(.*)$/)
|
next unless match = regex_match_group(arg, /^--(.*)$/)
|
||||||
|
|
||||||
problem "Reference '#{match[1]}' without dashes"
|
problem "Reference '#{match[1]}' without dashes"
|
||||||
end
|
end
|
||||||
@ -403,7 +403,7 @@ module RuboCop
|
|||||||
|
|
||||||
path = parameters(method).first
|
path = parameters(method).first
|
||||||
next unless path.str_type?
|
next unless path.str_type?
|
||||||
next unless match = regex_match_group(path, /^[^\*{},]+$/)
|
next unless match = regex_match_group(path, /^[^*{},]+$/)
|
||||||
|
|
||||||
problem "Dir([\"#{string_content(path)}\"]) is unnecessary; just use \"#{match[0]}\""
|
problem "Dir([\"#{string_content(path)}\"]) is unnecessary; just use \"#{match[0]}\""
|
||||||
end
|
end
|
||||||
|
@ -88,7 +88,7 @@ class SystemConfig
|
|||||||
_, err, status = system_command("java", args: ["-version"], print_stderr: false)
|
_, err, status = system_command("java", args: ["-version"], print_stderr: false)
|
||||||
return "N/A" unless status.success?
|
return "N/A" unless status.success?
|
||||||
|
|
||||||
err[/java version "([\d\._]+)"/, 1] || "N/A"
|
err[/java version "([\d._]+)"/, 1] || "N/A"
|
||||||
end
|
end
|
||||||
|
|
||||||
def describe_git
|
def describe_git
|
||||||
@ -100,7 +100,7 @@ class SystemConfig
|
|||||||
def describe_curl
|
def describe_curl
|
||||||
out, = system_command(curl_executable, args: ["--version"])
|
out, = system_command(curl_executable, args: ["--version"])
|
||||||
|
|
||||||
if /^curl (?<curl_version>[\d\.]+)/ =~ out
|
if /^curl (?<curl_version>[\d.]+)/ =~ out
|
||||||
"#{curl_version} => #{curl_executable}"
|
"#{curl_version} => #{curl_executable}"
|
||||||
else
|
else
|
||||||
"N/A"
|
"N/A"
|
||||||
|
@ -9,7 +9,7 @@ end
|
|||||||
describe "brew --cache", :integration_test do
|
describe "brew --cache", :integration_test do
|
||||||
it "prints all cache files for a given Formula" do
|
it "prints all cache files for a given Formula" do
|
||||||
expect { brew "--cache", testball }
|
expect { brew "--cache", testball }
|
||||||
.to output(%r{#{HOMEBREW_CACHE}/downloads/[\da-f]{64}\-\-testball\-}).to_stdout
|
.to output(%r{#{HOMEBREW_CACHE}/downloads/[\da-f]{64}--testball-}).to_stdout
|
||||||
.and not_to_output.to_stderr
|
.and not_to_output.to_stderr
|
||||||
.and be_a_success
|
.and be_a_success
|
||||||
end
|
end
|
||||||
|
@ -68,7 +68,7 @@ describe "brew install", :integration_test do
|
|||||||
# and there will be the git requirement, but we cannot instantiate git
|
# and there will be the git requirement, but we cannot instantiate git
|
||||||
# formula since we only have testball1 formula.
|
# formula since we only have testball1 formula.
|
||||||
expect { brew "install", "testball1", "--HEAD", "--ignore-dependencies" }
|
expect { brew "install", "testball1", "--HEAD", "--ignore-dependencies" }
|
||||||
.to output(%r{#{HOMEBREW_CELLAR}/testball1/HEAD\-d5eb689}).to_stdout
|
.to output(%r{#{HOMEBREW_CELLAR}/testball1/HEAD-d5eb689}).to_stdout
|
||||||
.and output(/Cloning into/).to_stderr
|
.and output(/Cloning into/).to_stderr
|
||||||
.and be_a_success
|
.and be_a_success
|
||||||
expect(HOMEBREW_CELLAR/"testball1/HEAD-d5eb689/foo/test").not_to be_a_file
|
expect(HOMEBREW_CELLAR/"testball1/HEAD-d5eb689/foo/test").not_to be_a_file
|
||||||
|
@ -73,7 +73,7 @@ describe RuboCop::Cop::FormulaAudit::Homepage do
|
|||||||
RUBY
|
RUBY
|
||||||
|
|
||||||
inspect_source(source)
|
inspect_source(source)
|
||||||
if homepage.match?(%r{http:\/\/www\.freedesktop\.org})
|
if homepage.match?(%r{http://www\.freedesktop\.org})
|
||||||
if homepage.match?(/Software/)
|
if homepage.match?(/Software/)
|
||||||
expected_offenses = [{ message: "#{homepage} should be styled " \
|
expected_offenses = [{ message: "#{homepage} should be styled " \
|
||||||
"`https://wiki.freedesktop.org/www/Software/project_name`",
|
"`https://wiki.freedesktop.org/www/Software/project_name`",
|
||||||
@ -89,7 +89,7 @@ describe RuboCop::Cop::FormulaAudit::Homepage do
|
|||||||
column: 2,
|
column: 2,
|
||||||
source: source }]
|
source: source }]
|
||||||
end
|
end
|
||||||
elsif homepage.match?(%r{https:\/\/code\.google\.com})
|
elsif homepage.match?(%r{https://code\.google\.com})
|
||||||
expected_offenses = [{ message: "#{homepage} should end with a slash",
|
expected_offenses = [{ message: "#{homepage} should end with a slash",
|
||||||
severity: :convention,
|
severity: :convention,
|
||||||
line: 2,
|
line: 2,
|
||||||
|
@ -19,7 +19,7 @@ describe Searchable do
|
|||||||
|
|
||||||
context "when given a regex" do
|
context "when given a regex" do
|
||||||
it "does not simplify strings" do
|
it "does not simplify strings" do
|
||||||
expect(subject.search(/with\-dashes/)).to eq ["with-dashes"]
|
expect(subject.search(/with-dashes/)).to eq ["with-dashes"]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -253,7 +253,7 @@ describe "globally-scoped helper methods" do
|
|||||||
)
|
)
|
||||||
}.to raise_error(
|
}.to raise_error(
|
||||||
MethodDeprecatedError,
|
MethodDeprecatedError,
|
||||||
%r{method.*replacement.*homebrew/core.*\/Taps\/homebrew\/homebrew-core\/}m,
|
%r{method.*replacement.*homebrew/core.*/Taps/homebrew/homebrew-core/}m,
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -168,7 +168,7 @@ module Kernel
|
|||||||
tap = Tap.fetch(match[:user], match[:repo])
|
tap = Tap.fetch(match[:user], match[:repo])
|
||||||
tap_message = +"\nPlease report this issue to the #{tap} tap (not Homebrew/brew or Homebrew/core)"
|
tap_message = +"\nPlease report this issue to the #{tap} tap (not Homebrew/brew or Homebrew/core)"
|
||||||
tap_message += ", or even better, submit a PR to fix it" if replacement
|
tap_message += ", or even better, submit a PR to fix it" if replacement
|
||||||
tap_message << ":\n #{line.sub(/^(.*\:\d+)\:.*$/, '\1')}\n\n"
|
tap_message << ":\n #{line.sub(/^(.*:\d+):.*$/, '\1')}\n\n"
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -196,7 +196,7 @@ def curl_http_content_headers_and_checksum(url, hash_needed: false, user_agent:
|
|||||||
status_code = :unknown
|
status_code = :unknown
|
||||||
while status_code == :unknown || status_code.to_s.start_with?("3")
|
while status_code == :unknown || status_code.to_s.start_with?("3")
|
||||||
headers, _, output = output.partition("\r\n\r\n")
|
headers, _, output = output.partition("\r\n\r\n")
|
||||||
status_code = headers[%r{HTTP\/.* (\d+)}, 1]
|
status_code = headers[%r{HTTP/.* (\d+)}, 1]
|
||||||
final_url = headers[/^Location:\s*(.*)$/i, 1]&.chomp
|
final_url = headers[/^Location:\s*(.*)$/i, 1]&.chomp
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -208,7 +208,7 @@ def curl_http_content_headers_and_checksum(url, hash_needed: false, user_agent:
|
|||||||
url: url,
|
url: url,
|
||||||
final_url: final_url,
|
final_url: final_url,
|
||||||
status: status_code,
|
status: status_code,
|
||||||
etag: headers[%r{ETag: ([wW]\/)?"(([^"]|\\")*)"}, 2],
|
etag: headers[%r{ETag: ([wW]/)?"(([^"]|\\")*)"}, 2],
|
||||||
content_length: headers[/Content-Length: (\d+)/, 1],
|
content_length: headers[/Content-Length: (\d+)/, 1],
|
||||||
file_hash: output_hash,
|
file_hash: output_hash,
|
||||||
file: output,
|
file: output,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user