Skip to content

Commit

Permalink
refactor: Formatting
Browse files Browse the repository at this point in the history
Signed-off-by: Fabrizio Demaria <[email protected]>
  • Loading branch information
fabriziodemaria committed Jan 30, 2025
1 parent e9e4bae commit 8e4e7eb
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 7 deletions.
10 changes: 8 additions & 2 deletions Sources/OpenFeature/Hook.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@ public protocol Hook {

func error<HookValue>(ctx: HookContext<HookValue>, error: Error, hints: [String: Any])

func finally<HookValue>(ctx: HookContext<HookValue>, details: FlagEvaluationDetails<HookValue>, hints: [String: Any])
func finally<HookValue>(
ctx: HookContext<HookValue>,
details: FlagEvaluationDetails<HookValue>,
hints: [String: Any]
)

func supportsFlagValueType(flagValueType: FlagValueType) -> Bool
}
Expand All @@ -31,7 +35,9 @@ extension Hook {
// Default implementation
}

public func finally<HookValue>(ctx: HookContext<HookValue>, details: FlagEvaluationDetails<HookValue>, hints: [String: Any]) {
public func finally<HookValue>(
ctx: HookContext<HookValue>, details: FlagEvaluationDetails<HookValue>, hints: [String: Any]
) {
// Default implementation
}

Expand Down
6 changes: 4 additions & 2 deletions Sources/OpenFeature/OpenFeatureClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ extension OpenFeatureClient {
switch openFeatureApiState.providerStatus {
case .fatal:
details.errorCode = .providerFatal
details.errorMessage = OpenFeatureError
details.errorMessage =
OpenFeatureError
.providerFatalError(message: "unknown")
.description
details.reason = Reason.error.rawValue
Expand All @@ -85,7 +86,8 @@ extension OpenFeatureClient {
return details
case .error:
details.errorCode = .general
details.errorMessage = OpenFeatureError
details.errorMessage =
OpenFeatureError
.generalError(message: "unknown")
.description
details.reason = Reason.error.rawValue
Expand Down
4 changes: 3 additions & 1 deletion Tests/OpenFeatureTests/Helpers/BooleanHookMock.swift
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ class BooleanHookMock: Hook {
self.addEval(self.prefix.isEmpty ? "error" : "\(self.prefix) error")
}

func finally<HookValue>(ctx: HookContext<HookValue>, details: FlagEvaluationDetails<HookValue>, hints: [String: Any]) {
func finally<HookValue>(
ctx: HookContext<HookValue>, details: FlagEvaluationDetails<HookValue>, hints: [String: Any]
) {
finallyCalled += 1
self.addEval(self.prefix.isEmpty ? "finally" : "\(self.prefix) finally")
}
Expand Down
4 changes: 3 additions & 1 deletion Tests/OpenFeatureTests/Helpers/IntHookMock.swift
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ class IntHookMock: Hook {
self.addEval(self.prefix.isEmpty ? "error" : "\(self.prefix) error")
}

func finally<HookValue>(ctx: HookContext<HookValue>, details: FlagEvaluationDetails<HookValue>, hints: [String: Any]) {
func finally<HookValue>(
ctx: HookContext<HookValue>, details: FlagEvaluationDetails<HookValue>, hints: [String: Any]
) {
finallyCalled += 1
self.addEval(self.prefix.isEmpty ? "finally" : "\(self.prefix) finally")
}
Expand Down
1 change: 0 additions & 1 deletion Tests/OpenFeatureTests/ValueTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ final class ValueTests: XCTestCase {
formatter.locale = Locale(identifier: "en_US_POSIX")
formatter.timeZone = TimeZone(secondsFromGMT: 0)


let date = try XCTUnwrap(formatter.date(from: "2022-01-01 12:00:00"))

let value: Value = .structure([
Expand Down

0 comments on commit 8e4e7eb

Please sign in to comment.