Merge pull request #17806 from samford/contributions-add-missing-requires
contributions, github: add missing requires, fix type errors
This commit is contained in:
commit
41e362f9e0
@ -2,10 +2,8 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require "abstract_command"
|
||||
require "warnings"
|
||||
Warnings.ignore :default_gems do
|
||||
require "csv"
|
||||
end
|
||||
require "tap"
|
||||
require "utils/github"
|
||||
|
||||
module Homebrew
|
||||
module DevCmd
|
||||
@ -50,12 +48,20 @@ module Homebrew
|
||||
results = {}
|
||||
grand_totals = {}
|
||||
|
||||
repos = if args.repositories.blank? || args.repositories&.include?("primary")
|
||||
PRIMARY_REPOS
|
||||
elsif args.repositories&.include?("all")
|
||||
SUPPORTED_REPOS
|
||||
else
|
||||
args.repositories
|
||||
repos = T.must(
|
||||
if args.repositories.blank? || args.repositories&.include?("primary")
|
||||
PRIMARY_REPOS
|
||||
elsif args.repositories&.include?("all")
|
||||
SUPPORTED_REPOS
|
||||
else
|
||||
args.repositories
|
||||
end,
|
||||
)
|
||||
|
||||
repos.each do |repo|
|
||||
if SUPPORTED_REPOS.exclude?(repo)
|
||||
odie "Unsupported repository: #{repo}. Try one of #{SUPPORTED_REPOS.join(", ")}."
|
||||
end
|
||||
end
|
||||
|
||||
from = args.from.presence || Date.today.prev_year.iso8601
|
||||
@ -118,6 +124,11 @@ module Homebrew
|
||||
|
||||
sig { params(totals: T::Hash[String, T::Hash[Symbol, Integer]]).returns(String) }
|
||||
def generate_csv(totals)
|
||||
require "warnings"
|
||||
Warnings.ignore :default_gems do
|
||||
require "csv"
|
||||
end
|
||||
|
||||
CSV.generate do |csv|
|
||||
csv << %w[user repo author committer coauthor review total]
|
||||
|
||||
@ -147,17 +158,18 @@ module Homebrew
|
||||
]
|
||||
end
|
||||
|
||||
sig { params(repos: T.nilable(T::Array[String]), person: String, from: String).void }
|
||||
sig {
|
||||
params(
|
||||
repos: T::Array[String],
|
||||
person: String,
|
||||
from: String,
|
||||
).returns(T::Hash[Symbol, T.untyped])
|
||||
}
|
||||
def scan_repositories(repos, person, from:)
|
||||
return if repos.blank?
|
||||
|
||||
data = {}
|
||||
return data if repos.blank?
|
||||
|
||||
repos.each do |repo|
|
||||
if SUPPORTED_REPOS.exclude?(repo)
|
||||
return ofail "Unsupported repository: #{repo}. Try one of #{SUPPORTED_REPOS.join(", ")}."
|
||||
end
|
||||
|
||||
repo_path = find_repo_path_for_repo(repo)
|
||||
tap = Tap.fetch("homebrew", repo)
|
||||
unless repo_path.exist?
|
||||
|
||||
@ -2,6 +2,8 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require "uri"
|
||||
require "utils/curl"
|
||||
require "utils/popen"
|
||||
require "utils/github/actions"
|
||||
require "utils/github/api"
|
||||
|
||||
|
||||
@ -3,6 +3,7 @@
|
||||
|
||||
require "system_command"
|
||||
require "tempfile"
|
||||
require "utils/curl"
|
||||
require "utils/shell"
|
||||
require "utils/formatter"
|
||||
require "utils/uid"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user