mirror of
https://github.com/Homebrew/BrewUI.git
synced 2026-10-02 08:34:36 +08:00
Formatting and linting
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
import Foundation
|
||||
|
||||
/// User-visible and diagnostic failure surfaced through ``BrewOperationPhase/failed(reason:)`` (`Sendable` for actor-isolated state).
|
||||
enum OperationFailure: Equatable, Sendable {
|
||||
enum OperationFailure: Equatable {
|
||||
/// `brew` ran but exited non-zero; stderr is the primary user-visible detail when present.
|
||||
case brewCommand(exitCode: Int32, stderr: String)
|
||||
|
||||
@@ -27,13 +27,19 @@ enum OperationFailure: Equatable, Sendable {
|
||||
if !trimmed.isEmpty {
|
||||
return trimmed
|
||||
}
|
||||
return String(localized: "Homebrew command failed.", comment: "Shown when brew exits non-zero with no stderr")
|
||||
return String(
|
||||
localized: "Homebrew command failed.",
|
||||
comment: "Shown when brew exits non-zero with no stderr",
|
||||
)
|
||||
|
||||
case let .brewLaunchFailed(diagnostic):
|
||||
return diagnostic
|
||||
|
||||
case .brewExecutableNotFound:
|
||||
return String(localized: "Could not find the brew executable.", comment: "Shown when brew binary is missing")
|
||||
return String(
|
||||
localized: "Could not find the brew executable.",
|
||||
comment: "Shown when brew binary is missing",
|
||||
)
|
||||
|
||||
case let .generic(userFacing, _):
|
||||
return userFacing
|
||||
|
||||
@@ -46,7 +46,9 @@ struct NoopBrewCommandCenterTests {
|
||||
private struct IncrementOnceCommand: BrewMutatingCommand {
|
||||
let counter: InvocationCounter
|
||||
|
||||
nonisolated var operationKind: BrewOperationKind { .upgradeFormula }
|
||||
nonisolated var operationKind: BrewOperationKind {
|
||||
.upgradeFormula
|
||||
}
|
||||
|
||||
func run(in context: BrewCommandExecutionContext) async throws {
|
||||
_ = context
|
||||
@@ -57,7 +59,9 @@ private struct IncrementOnceCommand: BrewMutatingCommand {
|
||||
private struct NoopThrowingCommand: BrewMutatingCommand {
|
||||
struct TestError: Error {}
|
||||
|
||||
nonisolated var operationKind: BrewOperationKind { .upgradeCask }
|
||||
nonisolated var operationKind: BrewOperationKind {
|
||||
.upgradeCask
|
||||
}
|
||||
|
||||
func run(in context: BrewCommandExecutionContext) async throws {
|
||||
_ = context
|
||||
|
||||
@@ -160,7 +160,9 @@ struct SerialBrewCommandCenterTests {
|
||||
// MARK: - Test commands
|
||||
|
||||
private struct EmptyMutatingCommand: BrewMutatingCommand {
|
||||
nonisolated var operationKind: BrewOperationKind { .upgradeFormula }
|
||||
nonisolated var operationKind: BrewOperationKind {
|
||||
.upgradeFormula
|
||||
}
|
||||
|
||||
func run(in context: BrewCommandExecutionContext) async throws {
|
||||
_ = context
|
||||
@@ -170,7 +172,9 @@ private struct EmptyMutatingCommand: BrewMutatingCommand {
|
||||
private struct ThrowingMutatingCommand: BrewMutatingCommand {
|
||||
struct TestError: Error {}
|
||||
|
||||
nonisolated var operationKind: BrewOperationKind { .upgradeFormula }
|
||||
nonisolated var operationKind: BrewOperationKind {
|
||||
.upgradeFormula
|
||||
}
|
||||
|
||||
func run(in context: BrewCommandExecutionContext) async throws {
|
||||
_ = context
|
||||
@@ -194,7 +198,9 @@ private struct OrderingSleepCommand: BrewMutatingCommand {
|
||||
let collector: OrderCollector
|
||||
let prefix: String
|
||||
|
||||
nonisolated var operationKind: BrewOperationKind { .upgradeFormula }
|
||||
nonisolated var operationKind: BrewOperationKind {
|
||||
.upgradeFormula
|
||||
}
|
||||
|
||||
func run(in context: BrewCommandExecutionContext) async throws {
|
||||
_ = context
|
||||
@@ -208,7 +214,9 @@ private struct AppendTokenCommand: BrewMutatingCommand {
|
||||
let collector: OrderCollector
|
||||
let token: String
|
||||
|
||||
nonisolated var operationKind: BrewOperationKind { .upgradeFormula }
|
||||
nonisolated var operationKind: BrewOperationKind {
|
||||
.upgradeFormula
|
||||
}
|
||||
|
||||
func run(in context: BrewCommandExecutionContext) async throws {
|
||||
_ = context
|
||||
@@ -227,7 +235,9 @@ private actor InvocationCounter {
|
||||
private struct SlowIncrementCommand: BrewMutatingCommand {
|
||||
let counter: InvocationCounter
|
||||
|
||||
nonisolated var operationKind: BrewOperationKind { .upgradeFormula }
|
||||
nonisolated var operationKind: BrewOperationKind {
|
||||
.upgradeFormula
|
||||
}
|
||||
|
||||
func run(in context: BrewCommandExecutionContext) async throws {
|
||||
_ = context
|
||||
@@ -239,7 +249,9 @@ private struct SlowIncrementCommand: BrewMutatingCommand {
|
||||
private struct RunMockedArgvCommand: BrewMutatingCommand {
|
||||
let arguments: [String]
|
||||
|
||||
nonisolated var operationKind: BrewOperationKind { .upgradeFormula }
|
||||
nonisolated var operationKind: BrewOperationKind {
|
||||
.upgradeFormula
|
||||
}
|
||||
|
||||
func run(in context: BrewCommandExecutionContext) async throws {
|
||||
let url = try context.brewExecutableURL()
|
||||
|
||||
Reference in New Issue
Block a user