Adjust typing around #check_pull_requests
`brew bump-formula-pr` is encountering a type error, as the inferred return type of `GitHub#check_for_duplicate_pull_requests` doesn't align with the explicit return type of `#check_pull_requests`: ``` Error: Return value: Expected type T.nilable(T::Array[String]), got type Module with value T::Private::Types::Void::VOID Caller: /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/dev-cmd/ bump-formula-pr.rb:137 Definition: /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/ dev-cmd/bump-formula-pr.rb:472 (Homebrew::DevCmd::BumpFormulaPr #check_pull_requests) ``` This addresses the issue by adding a type signature with a `void` return type to `#check_for_duplicate_pull_requests` and setting the return type of `#check_pull_requests` to `void` as well. The return type from `#check_pull_requests` isn't used, so a `void` return type is arguably a better reflection of the method's behavior. The `#check_pull_requests` method in `BumpCaskPr` has a `void` return type, so this change brings the `BumpFormulaPr` method in line.
This commit is contained in:
parent
7b067dca52
commit
24ac6967ba
@ -467,7 +467,7 @@ module Homebrew
|
|||||||
|
|
||||||
sig {
|
sig {
|
||||||
params(formula: Formula, tap_remote_repo: String, state: T.nilable(String),
|
params(formula: Formula, tap_remote_repo: String, state: T.nilable(String),
|
||||||
version: T.nilable(String)).returns(T.nilable(T::Array[String]))
|
version: T.nilable(String)).void
|
||||||
}
|
}
|
||||||
def check_pull_requests(formula, tap_remote_repo, state: nil, version: nil)
|
def check_pull_requests(formula, tap_remote_repo, state: nil, version: nil)
|
||||||
tap = formula.tap
|
tap = formula.tap
|
||||||
|
|||||||
@ -629,7 +629,17 @@ module GitHub
|
|||||||
pull_requests || []
|
pull_requests || []
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.check_for_duplicate_pull_requests(name, tap_remote_repo, file:, quiet:, state: nil, version: nil)
|
sig {
|
||||||
|
params(
|
||||||
|
name: String,
|
||||||
|
tap_remote_repo: String,
|
||||||
|
file: String,
|
||||||
|
quiet: T::Boolean,
|
||||||
|
state: T.nilable(String),
|
||||||
|
version: T.nilable(String),
|
||||||
|
).void
|
||||||
|
}
|
||||||
|
def self.check_for_duplicate_pull_requests(name, tap_remote_repo, file:, quiet: false, state: nil, version: nil)
|
||||||
pull_requests = fetch_pull_requests(name, tap_remote_repo, state:, version:)
|
pull_requests = fetch_pull_requests(name, tap_remote_repo, state:, version:)
|
||||||
|
|
||||||
pull_requests.select! do |pr|
|
pull_requests.select! do |pr|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user