Skip to content

Commit

Permalink
fix(lint): Fix linting issues
Browse files Browse the repository at this point in the history
Signed-off-by: Thomas Poignant <[email protected]>
  • Loading branch information
thomaspoignant committed Dec 23, 2024
1 parent 2dee5db commit aef919d
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 31 deletions.
3 changes: 2 additions & 1 deletion Sources/GOFeatureFlag/hook/data_collector_bool_hook.swift
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ class BooleanHook: Hook {
self.dataCollectorMngr.appendFeatureEvent(event: event)
}

func finally<HookValue>(ctx: HookContext<HookValue>, details: FlagEvaluationDetails<HookValue>, hints: [String: Any]){
func finally<HookValue>(
ctx: HookContext<HookValue>, details: FlagEvaluationDetails<HookValue>, hints: [String: Any]) {
return
}
}
3 changes: 2 additions & 1 deletion Sources/GOFeatureFlag/hook/data_collector_double_hook.swift
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ class DoubleHook: Hook {
self.dataCollectorMngr.appendFeatureEvent(event: event)
}

func finally<HookValue>(ctx: HookContext<HookValue>, details: FlagEvaluationDetails<HookValue>, hints: [String: Any]){
func finally<HookValue>(
ctx: HookContext<HookValue>, details: FlagEvaluationDetails<HookValue>, hints: [String: Any]) {
return
}
}
3 changes: 2 additions & 1 deletion Sources/GOFeatureFlag/hook/data_collector_integer_hook.swift
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ class IntegerHook: Hook {
self.dataCollectorMngr.appendFeatureEvent(event: event)
}

func finally<HookValue>(ctx: HookContext<HookValue>, details: FlagEvaluationDetails<HookValue>, hints: [String: Any]){
func finally<HookValue>(
ctx: HookContext<HookValue>, details: FlagEvaluationDetails<HookValue>, hints: [String: Any]) {
return
}
}
4 changes: 2 additions & 2 deletions Sources/GOFeatureFlag/hook/data_collector_object_hook.swift
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ class ObjectHook: Hook {
self.dataCollectorMngr.appendFeatureEvent(event: event)
}


func finally<HookValue>(ctx: HookContext<HookValue>, details: FlagEvaluationDetails<HookValue>, hints: [String: Any]){
func finally<HookValue>(
ctx: HookContext<HookValue>, details: FlagEvaluationDetails<HookValue>, hints: [String: Any]) {
return
}
}
3 changes: 2 additions & 1 deletion Sources/GOFeatureFlag/hook/data_collector_string_hook.swift
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ class StringHook: Hook {
self.dataCollectorMngr.appendFeatureEvent(event: event)
}

func finally<HookValue>(ctx: HookContext<HookValue>, details: FlagEvaluationDetails<HookValue>, hints: [String: Any]){
func finally<HookValue>(
ctx: HookContext<HookValue>, details: FlagEvaluationDetails<HookValue>, hints: [String: Any]) {
return
}
}
4 changes: 2 additions & 2 deletions Tests/GOFeatureFlagTests/goff_api_tests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class GoffApiTests: XCTestCase {
FeatureEvent(kind: "feature", userKey: "981f2662-1fb4-4732-ac6d-8399d9205aa9", creationDate: Int64(Date().timeIntervalSince1970), key: "flag-1", variation: "enabled", value: JSONValue.bool(true), default: false, version: nil, source: "PROVIDER_CACHE")
]
do {
let (response, _) = try await goffAPI.postDataCollector(events: events)
_ = try await goffAPI.postDataCollector(events: events)
XCTFail("Expected to throw GoFeatureFlagError.apiUnauthorizedError, but no error was thrown.")
} catch let error as GoFeatureFlagError {
switch error {
Expand All @@ -52,7 +52,7 @@ class GoffApiTests: XCTestCase {
FeatureEvent(kind: "feature", userKey: "981f2662-1fb4-4732-ac6d-8399d9205aa9", creationDate: Int64(Date().timeIntervalSince1970), key: "flag-1", variation: "enabled", value: JSONValue.bool(true), default: false, version: nil, source: "PROVIDER_CACHE")
]
do {
let (response, _) = try await goffAPI.postDataCollector(events: events)
_ = try await goffAPI.postDataCollector(events: events)
XCTFail("Expected to throw GoFeatureFlagError.forbiddenError, but no error was thrown.")
} catch let error as GoFeatureFlagError {
switch error {
Expand Down
8 changes: 4 additions & 4 deletions Tests/GOFeatureFlagTests/provider_tests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ class GoFeatureFlagProviderTests: XCTestCase {
_ = client.getIntegerDetails(key: "int-flag", defaultValue: 1)

let expectation = self.expectation(description: "Waiting for delay")
DispatchQueue.global().asyncAfter(deadline: .now() + 3.0) { expectation.fulfill() }
await fulfillment(of: [expectation], timeout: 4.0)
DispatchQueue.global().asyncAfter(deadline: .now() + 4.0) { expectation.fulfill() }
await fulfillment(of: [expectation], timeout: 5.0)

XCTAssertEqual(1, mockNetworkService.dataCollectorCallCounter)
XCTAssertEqual(3, mockNetworkService.dataCollectorEventCounter)
Expand All @@ -71,8 +71,8 @@ class GoFeatureFlagProviderTests: XCTestCase {
_ = client.getObjectDetails(key: "object-flag", defaultValue: Value.null)

let expectation2 = self.expectation(description: "Waiting for delay")
DispatchQueue.global().asyncAfter(deadline: .now() + 3.0) { expectation2.fulfill() }
await fulfillment(of: [expectation2], timeout: 4.0)
DispatchQueue.global().asyncAfter(deadline: .now() + 4.0) { expectation2.fulfill() }
await fulfillment(of: [expectation2], timeout: 5.0)

XCTAssertEqual(2, mockNetworkService.dataCollectorCallCounter)
XCTAssertEqual(6, mockNetworkService.dataCollectorEventCounter)
Expand Down
39 changes: 20 additions & 19 deletions Tests/OFREPTests/provider_tests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class ProviderTests: XCTestCase {
let expectation = XCTestExpectation(description: "waiting 1st event")
let cancellable = api.observe().sink{ event in
if(event != ProviderEvent.error(errorCode: nil, message: "The operation couldn’t be completed. (OFREP.OfrepError error 3.)")){
XCTFail("If OFREP API returns a 429 we should receive an ERROR event, received: \(event)")
XCTFail("If OFREP API returns a 429 we should receive an ERROR event, received: \(String(describing: event)))")
}
expectation.fulfill()
}
Expand Down Expand Up @@ -106,7 +106,7 @@ class ProviderTests: XCTestCase {
let expectation = XCTestExpectation(description: "waiting 1st event")
let cancellable = api.observe().sink{ event in
if(event != ProviderEvent.error(errorCode: nil, message: "The operation couldn’t be completed. (OpenFeature.OpenFeatureError error 5.)")){
XCTFail("If OFREP API returns a 400 for TARGETING_KEY_MISSING we should receive an ERROR event, received: \(event)")
XCTFail("If OFREP API returns a 400 for TARGETING_KEY_MISSING we should receive an ERROR event, received: \(String(describing: event)))")
}
expectation.fulfill()
}
Expand Down Expand Up @@ -134,7 +134,7 @@ class ProviderTests: XCTestCase {

let cancellable = api.observe().sink{ event in
if(event != ProviderEvent.error(errorCode: nil, message: "The operation couldn’t be completed. (OpenFeature.OpenFeatureError error 4.)")){
XCTFail("If OFREP API returns a 400 for INVALID_CONTEXT we should receive an ERROR event, received: \(event)")
XCTFail("If OFREP API returns a 400 for INVALID_CONTEXT we should receive an ERROR event, received: \(String(describing: event))")
}
expectation.fulfill()
}
Expand Down Expand Up @@ -164,7 +164,7 @@ class ProviderTests: XCTestCase {
let expectation = XCTestExpectation(description: "waiting 1st event")
let cancellable = api.observe().sink{ event in
if(event != ProviderEvent.error(errorCode: nil, message: "The operation couldn’t be completed. (OpenFeature.OpenFeatureError error 2.)")){
XCTFail("If OFREP API returns a 400 for PARSE_ERROR we should receive an ERROR event, received: \(event)")
XCTFail("If OFREP API returns a 400 for PARSE_ERROR we should receive an ERROR event, received: \(String(describing: event)))")
}
expectation.fulfill()
}
Expand All @@ -187,7 +187,7 @@ class ProviderTests: XCTestCase {
let expectation = XCTestExpectation(description: "waiting 1st event")
let cancellable = api.observe().sink{ event in
if(event != ProviderEvent.ready){
XCTFail("If OFREP API returns a 200 we should receive a ready event, received: \(event)")
XCTFail("If OFREP API returns a 200 we should receive a ready event, received: \(String(describing: event)))")
}
expectation.fulfill()
}
Expand All @@ -212,7 +212,7 @@ class ProviderTests: XCTestCase {
let expectation = XCTestExpectation(description: "waiting 1st event")
let cancellable = api.observe().sink{ event in
if(event != ProviderEvent.ready){
XCTFail("If OFREP API returns a 200 we should receive a ready event, received: \(event)")
XCTFail("If OFREP API returns a 200 we should receive a ready event, received: \(String(describing: event)))")
}
expectation.fulfill()
}
Expand Down Expand Up @@ -264,7 +264,7 @@ class ProviderTests: XCTestCase {
let expectation = XCTestExpectation(description: "waiting 1st event")
let cancellable = api.observe().sink{ event in
if(event != ProviderEvent.ready){
XCTFail("If OFREP API returns a 200 we should receive a ready event, received: \(event)")
XCTFail("If OFREP API returns a 200 we should receive a ready event, received: \(String(describing: event)))")
}
expectation.fulfill()
}
Expand Down Expand Up @@ -300,7 +300,7 @@ class ProviderTests: XCTestCase {
case .ready:
expect.fulfill()
default:
XCTFail("If OFREP API returns a 200 we should receive a ready event, received: \(event)")
XCTFail("If OFREP API returns a 200 we should receive a ready event, received: \(String(describing: event)))")
expect.fulfill()
}
}
Expand Down Expand Up @@ -462,7 +462,7 @@ class ProviderTests: XCTestCase {
let expectation = XCTestExpectation(description: "waiting 1st event")
let cancellable = api.observe().sink{ event in
if(event != ProviderEvent.ready){
XCTFail("If OFREP API returns a 200 we should receive a ready event, received: \(event)")
XCTFail("If OFREP API returns a 200 we should receive a ready event, received: \(String(describing: event)))")
}
expectation.fulfill()
}
Expand Down Expand Up @@ -495,12 +495,13 @@ class ProviderTests: XCTestCase {
let expectation = XCTestExpectation(description: "waiting 1st event")
let cancellable = api.observe().sink{ event in
if(event != ProviderEvent.ready){
XCTFail("If OFREP API returns a 200 we should receive a ready event, received: \(event)")
XCTFail("If OFREP API returns a 200 we should receive a ready event, received: \(String(describing: event)))")
}
expectation.fulfill()
}
await api.setProviderAndWait(provider: provider, initialContext: defaultEvaluationContext)
await fulfillment(of: [expectation], timeout: 3)
cancellable.cancel()

let client = api.getClient()
let details = client.getIntegerDetails(key: "int-flag", defaultValue: 1)
Expand Down Expand Up @@ -528,7 +529,7 @@ class ProviderTests: XCTestCase {
let expectation = XCTestExpectation(description: "waiting 1st event")
let cancellable = api.observe().sink{ event in
if(event != ProviderEvent.ready){
XCTFail("If OFREP API returns a 200 we should receive a ready event, received: \(event)")
XCTFail("If OFREP API returns a 200 we should receive a ready event, received: \(String(describing: event)))")
}
expectation.fulfill()
}
Expand Down Expand Up @@ -559,7 +560,7 @@ class ProviderTests: XCTestCase {
let expectation = XCTestExpectation(description: "waiting 1st event")
let cancellable = api.observe().sink{ event in
if(event != ProviderEvent.ready){
XCTFail("If OFREP API returns a 200 we should receive a ready event, received: \(event)")
XCTFail("If OFREP API returns a 200 we should receive a ready event, received: \(String(describing: event)))")
}
expectation.fulfill()
}
Expand Down Expand Up @@ -590,7 +591,7 @@ class ProviderTests: XCTestCase {
let expectation = XCTestExpectation(description: "waiting 1st event")
let cancellable = api.observe().sink{ event in
if(event != ProviderEvent.ready){
XCTFail("If OFREP API returns a 200 we should receive a ready event, received: \(event)")
XCTFail("If OFREP API returns a 200 we should receive a ready event, received: \(String(describing: event)))")
}
expectation.fulfill()
}
Expand Down Expand Up @@ -621,7 +622,7 @@ class ProviderTests: XCTestCase {
let expectation = XCTestExpectation(description: "waiting 1st event")
let cancellable = api.observe().sink{ event in
if(event != ProviderEvent.ready){
XCTFail("If OFREP API returns a 200 we should receive a ready event, received: \(event)")
XCTFail("If OFREP API returns a 200 we should receive a ready event, received: \(String(describing: event)))")
}
expectation.fulfill()
}
Expand Down Expand Up @@ -652,7 +653,7 @@ class ProviderTests: XCTestCase {
let expectation = XCTestExpectation(description: "waiting 1st event")
let cancellable = api.observe().sink{ event in
if(event != ProviderEvent.ready){
XCTFail("If OFREP API returns a 200 we should receive a ready event, received: \(event)")
XCTFail("If OFREP API returns a 200 we should receive a ready event, received: \(String(describing: event)))")
}
expectation.fulfill()
}
Expand All @@ -677,7 +678,7 @@ class ProviderTests: XCTestCase {
let expectation = XCTestExpectation(description: "waiting 1st event")
let cancellable = api.observe().sink{ event in
if(event != ProviderEvent.ready){
XCTFail("If OFREP API returns a 200 we should receive a ready event, received: \(event)")
XCTFail("If OFREP API returns a 200 we should receive a ready event, received: \(String(describing: event)))")
}
expectation.fulfill()
}
Expand All @@ -702,7 +703,7 @@ class ProviderTests: XCTestCase {
let expectation = XCTestExpectation(description: "waiting 1st event")
let cancellable = api.observe().sink{ event in
if(event != ProviderEvent.ready){
XCTFail("If OFREP API returns a 200 we should receive a ready event, received: \(event)")
XCTFail("If OFREP API returns a 200 we should receive a ready event, received: \(String(describing: event)))")
}
expectation.fulfill()
}
Expand All @@ -727,7 +728,7 @@ class ProviderTests: XCTestCase {
let expectation = XCTestExpectation(description: "waiting 1st event")
let cancellable = api.observe().sink{ event in
if(event != ProviderEvent.ready){
XCTFail("If OFREP API returns a 200 we should receive a ready event, received: \(event)")
XCTFail("If OFREP API returns a 200 we should receive a ready event, received: \(String(describing: event)))")
}
expectation.fulfill()
}
Expand All @@ -752,7 +753,7 @@ class ProviderTests: XCTestCase {
let expectation = XCTestExpectation(description: "waiting 1st event")
let cancellable = api.observe().sink{ event in
if(event != ProviderEvent.ready){
XCTFail("If OFREP API returns a 200 we should receive a ready event, received: \(event)")
XCTFail("If OFREP API returns a 200 we should receive a ready event, received: \(String(describing: event)))")
}
expectation.fulfill()
}
Expand Down

0 comments on commit aef919d

Please sign in to comment.