Manual brew style fixes.

This commit is contained in:
Mike McQuaid 2018-11-02 17:27:24 +00:00
parent 737b84b54b
commit 549b02f20a
No known key found for this signature in database
GPG Key ID: 48A898132FD8EE70
3 changed files with 28 additions and 14 deletions

View File

@ -327,7 +327,7 @@ class Formula
active_spec == head active_spec == head
end end
delegate [ delegate [ # rubocop:disable Layout/AlignHash
:bottle_unneeded?, :bottle_unneeded?,
:bottle_disabled?, :bottle_disabled?,
:bottle_disable_reason, :bottle_disable_reason,
@ -335,7 +335,7 @@ class Formula
:bottled?, :bottled?,
:bottle_specification, :bottle_specification,
:downloader, :downloader,
] => :active_spec ] => :active_spec
# The Bottle object for the currently active {SoftwareSpec}. # The Bottle object for the currently active {SoftwareSpec}.
# @private # @private
@ -1615,10 +1615,20 @@ class Formula
"bottle" => {}, "bottle" => {},
"keg_only" => keg_only?, "keg_only" => keg_only?,
"options" => [], "options" => [],
"build_dependencies" => dependencies.select(&:build?).map(&:name).uniq, "build_dependencies" => dependencies.select(&:build?)
"dependencies" => dependencies.reject(&:optional?).reject(&:recommended?).reject(&:build?).map(&:name).uniq, .map(&:name)
"recommended_dependencies" => dependencies.select(&:recommended?).map(&:name).uniq, .uniq,
"optional_dependencies" => dependencies.select(&:optional?).map(&:name).uniq, "dependencies" => dependencies.reject(&:optional?)
.reject(&:recommended?)
.reject(&:build?)
.map(&:name)
.uniq,
"recommended_dependencies" => dependencies.select(&:recommended?)
.map(&:name)
.uniq,
"optional_dependencies" => dependencies.select(&:optional?)
.map(&:name)
.uniq,
"requirements" => [], "requirements" => [],
"conflicts_with" => conflicts.map(&:name), "conflicts_with" => conflicts.map(&:name),
"caveats" => caveats, "caveats" => caveats,
@ -1641,9 +1651,10 @@ class Formula
} }
bottle_info["files"] = {} bottle_info["files"] = {}
bottle_spec.collector.keys.each do |os| bottle_spec.collector.keys.each do |os|
bottle_url = "#{bottle_spec.root_url}/#{Bottle::Filename.create(self, os, bottle_spec.rebuild).bintray}"
checksum = bottle_spec.collector[os] checksum = bottle_spec.collector[os]
bottle_info["files"][os] = { bottle_info["files"][os] = {
"url" => "#{bottle_spec.root_url}/#{Bottle::Filename.create(self, os, bottle_spec.rebuild).bintray}", "url" => bottle_url,
checksum.hash_type.to_s => checksum.hexdigest, checksum.hash_type.to_s => checksum.hexdigest,
} }
end end

View File

@ -104,8 +104,10 @@ module Homebrew
end end
end end
HOMEBREW_PULL_API_REGEX = %r{https://api\.github\.com/repos/([\w-]+)/([\w-]+)?/pulls/(\d+)}.freeze HOMEBREW_PULL_API_REGEX =
HOMEBREW_PULL_OR_COMMIT_URL_REGEX = %r[https://github\.com/([\w-]+)/([\w-]+)?/(?:pull/(\d+)|commit/[0-9a-fA-F]{4,40})].freeze %r{https://api\.github\.com/repos/([\w-]+)/([\w-]+)?/pulls/(\d+)}.freeze
HOMEBREW_PULL_OR_COMMIT_URL_REGEX =
%r[https://github\.com/([\w-]+)/([\w-]+)?/(?:pull/(\d+)|commit/[0-9a-fA-F]{4,40})].freeze
require "forwardable" require "forwardable"
require "PATH" require "PATH"

View File

@ -32,11 +32,12 @@ describe RuboCop::Cop::FormulaAudit::Homepage do
end end
RUBY RUBY
expected_offenses = [{ message: "The homepage should start with http or https (URL is ftp://example.com/foo).", expected_offenses = [{ message: "The homepage should start with http or " \
severity: :convention, "https (URL is ftp://example.com/foo).",
line: 2, severity: :convention,
column: 2, line: 2,
source: source }] column: 2,
source: source }]
inspect_source(source) inspect_source(source)