Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit aef919d

Browse files
committedDec 23, 2024·
fix(lint): Fix linting issues
Signed-off-by: Thomas Poignant <[email protected]>
1 parent 2dee5db commit aef919d

8 files changed

+36
-31
lines changed
 

Diff for: ‎Sources/GOFeatureFlag/hook/data_collector_bool_hook.swift

+2-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,8 @@ class BooleanHook: Hook {
6666
self.dataCollectorMngr.appendFeatureEvent(event: event)
6767
}
6868

69-
func finally<HookValue>(ctx: HookContext<HookValue>, details: FlagEvaluationDetails<HookValue>, hints: [String: Any]){
69+
func finally<HookValue>(
70+
ctx: HookContext<HookValue>, details: FlagEvaluationDetails<HookValue>, hints: [String: Any]) {
7071
return
7172
}
7273
}

Diff for: ‎Sources/GOFeatureFlag/hook/data_collector_double_hook.swift

+2-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@ class DoubleHook: Hook {
6767
self.dataCollectorMngr.appendFeatureEvent(event: event)
6868
}
6969

70-
func finally<HookValue>(ctx: HookContext<HookValue>, details: FlagEvaluationDetails<HookValue>, hints: [String: Any]){
70+
func finally<HookValue>(
71+
ctx: HookContext<HookValue>, details: FlagEvaluationDetails<HookValue>, hints: [String: Any]) {
7172
return
7273
}
7374
}

Diff for: ‎Sources/GOFeatureFlag/hook/data_collector_integer_hook.swift

+2-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,8 @@ class IntegerHook: Hook {
6363
self.dataCollectorMngr.appendFeatureEvent(event: event)
6464
}
6565

66-
func finally<HookValue>(ctx: HookContext<HookValue>, details: FlagEvaluationDetails<HookValue>, hints: [String: Any]){
66+
func finally<HookValue>(
67+
ctx: HookContext<HookValue>, details: FlagEvaluationDetails<HookValue>, hints: [String: Any]) {
6768
return
6869
}
6970
}

Diff for: ‎Sources/GOFeatureFlag/hook/data_collector_object_hook.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@ class ObjectHook: Hook {
6565
self.dataCollectorMngr.appendFeatureEvent(event: event)
6666
}
6767

68-
69-
func finally<HookValue>(ctx: HookContext<HookValue>, details: FlagEvaluationDetails<HookValue>, hints: [String: Any]){
68+
func finally<HookValue>(
69+
ctx: HookContext<HookValue>, details: FlagEvaluationDetails<HookValue>, hints: [String: Any]) {
7070
return
7171
}
7272
}

Diff for: ‎Sources/GOFeatureFlag/hook/data_collector_string_hook.swift

+2-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,8 @@ class StringHook: Hook {
6666
self.dataCollectorMngr.appendFeatureEvent(event: event)
6767
}
6868

69-
func finally<HookValue>(ctx: HookContext<HookValue>, details: FlagEvaluationDetails<HookValue>, hints: [String: Any]){
69+
func finally<HookValue>(
70+
ctx: HookContext<HookValue>, details: FlagEvaluationDetails<HookValue>, hints: [String: Any]) {
7071
return
7172
}
7273
}

Diff for: ‎Tests/GOFeatureFlagTests/goff_api_tests.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class GoffApiTests: XCTestCase {
3030
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")
3131
]
3232
do {
33-
let (response, _) = try await goffAPI.postDataCollector(events: events)
33+
_ = try await goffAPI.postDataCollector(events: events)
3434
XCTFail("Expected to throw GoFeatureFlagError.apiUnauthorizedError, but no error was thrown.")
3535
} catch let error as GoFeatureFlagError {
3636
switch error {
@@ -52,7 +52,7 @@ class GoffApiTests: XCTestCase {
5252
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")
5353
]
5454
do {
55-
let (response, _) = try await goffAPI.postDataCollector(events: events)
55+
_ = try await goffAPI.postDataCollector(events: events)
5656
XCTFail("Expected to throw GoFeatureFlagError.forbiddenError, but no error was thrown.")
5757
} catch let error as GoFeatureFlagError {
5858
switch error {

Diff for: ‎Tests/GOFeatureFlagTests/provider_tests.swift

+4-4
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ class GoFeatureFlagProviderTests: XCTestCase {
6060
_ = client.getIntegerDetails(key: "int-flag", defaultValue: 1)
6161

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

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

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

7777
XCTAssertEqual(2, mockNetworkService.dataCollectorCallCounter)
7878
XCTAssertEqual(6, mockNetworkService.dataCollectorEventCounter)

Diff for: ‎Tests/OFREPTests/provider_tests.swift

+20-19
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ class ProviderTests: XCTestCase {
7777
let expectation = XCTestExpectation(description: "waiting 1st event")
7878
let cancellable = api.observe().sink{ event in
7979
if(event != ProviderEvent.error(errorCode: nil, message: "The operation couldn’t be completed. (OFREP.OfrepError error 3.)")){
80-
XCTFail("If OFREP API returns a 429 we should receive an ERROR event, received: \(event)")
80+
XCTFail("If OFREP API returns a 429 we should receive an ERROR event, received: \(String(describing: event)))")
8181
}
8282
expectation.fulfill()
8383
}
@@ -106,7 +106,7 @@ class ProviderTests: XCTestCase {
106106
let expectation = XCTestExpectation(description: "waiting 1st event")
107107
let cancellable = api.observe().sink{ event in
108108
if(event != ProviderEvent.error(errorCode: nil, message: "The operation couldn’t be completed. (OpenFeature.OpenFeatureError error 5.)")){
109-
XCTFail("If OFREP API returns a 400 for TARGETING_KEY_MISSING we should receive an ERROR event, received: \(event)")
109+
XCTFail("If OFREP API returns a 400 for TARGETING_KEY_MISSING we should receive an ERROR event, received: \(String(describing: event)))")
110110
}
111111
expectation.fulfill()
112112
}
@@ -134,7 +134,7 @@ class ProviderTests: XCTestCase {
134134

135135
let cancellable = api.observe().sink{ event in
136136
if(event != ProviderEvent.error(errorCode: nil, message: "The operation couldn’t be completed. (OpenFeature.OpenFeatureError error 4.)")){
137-
XCTFail("If OFREP API returns a 400 for INVALID_CONTEXT we should receive an ERROR event, received: \(event)")
137+
XCTFail("If OFREP API returns a 400 for INVALID_CONTEXT we should receive an ERROR event, received: \(String(describing: event))")
138138
}
139139
expectation.fulfill()
140140
}
@@ -164,7 +164,7 @@ class ProviderTests: XCTestCase {
164164
let expectation = XCTestExpectation(description: "waiting 1st event")
165165
let cancellable = api.observe().sink{ event in
166166
if(event != ProviderEvent.error(errorCode: nil, message: "The operation couldn’t be completed. (OpenFeature.OpenFeatureError error 2.)")){
167-
XCTFail("If OFREP API returns a 400 for PARSE_ERROR we should receive an ERROR event, received: \(event)")
167+
XCTFail("If OFREP API returns a 400 for PARSE_ERROR we should receive an ERROR event, received: \(String(describing: event)))")
168168
}
169169
expectation.fulfill()
170170
}
@@ -187,7 +187,7 @@ class ProviderTests: XCTestCase {
187187
let expectation = XCTestExpectation(description: "waiting 1st event")
188188
let cancellable = api.observe().sink{ event in
189189
if(event != ProviderEvent.ready){
190-
XCTFail("If OFREP API returns a 200 we should receive a ready event, received: \(event)")
190+
XCTFail("If OFREP API returns a 200 we should receive a ready event, received: \(String(describing: event)))")
191191
}
192192
expectation.fulfill()
193193
}
@@ -212,7 +212,7 @@ class ProviderTests: XCTestCase {
212212
let expectation = XCTestExpectation(description: "waiting 1st event")
213213
let cancellable = api.observe().sink{ event in
214214
if(event != ProviderEvent.ready){
215-
XCTFail("If OFREP API returns a 200 we should receive a ready event, received: \(event)")
215+
XCTFail("If OFREP API returns a 200 we should receive a ready event, received: \(String(describing: event)))")
216216
}
217217
expectation.fulfill()
218218
}
@@ -264,7 +264,7 @@ class ProviderTests: XCTestCase {
264264
let expectation = XCTestExpectation(description: "waiting 1st event")
265265
let cancellable = api.observe().sink{ event in
266266
if(event != ProviderEvent.ready){
267-
XCTFail("If OFREP API returns a 200 we should receive a ready event, received: \(event)")
267+
XCTFail("If OFREP API returns a 200 we should receive a ready event, received: \(String(describing: event)))")
268268
}
269269
expectation.fulfill()
270270
}
@@ -300,7 +300,7 @@ class ProviderTests: XCTestCase {
300300
case .ready:
301301
expect.fulfill()
302302
default:
303-
XCTFail("If OFREP API returns a 200 we should receive a ready event, received: \(event)")
303+
XCTFail("If OFREP API returns a 200 we should receive a ready event, received: \(String(describing: event)))")
304304
expect.fulfill()
305305
}
306306
}
@@ -462,7 +462,7 @@ class ProviderTests: XCTestCase {
462462
let expectation = XCTestExpectation(description: "waiting 1st event")
463463
let cancellable = api.observe().sink{ event in
464464
if(event != ProviderEvent.ready){
465-
XCTFail("If OFREP API returns a 200 we should receive a ready event, received: \(event)")
465+
XCTFail("If OFREP API returns a 200 we should receive a ready event, received: \(String(describing: event)))")
466466
}
467467
expectation.fulfill()
468468
}
@@ -495,12 +495,13 @@ class ProviderTests: XCTestCase {
495495
let expectation = XCTestExpectation(description: "waiting 1st event")
496496
let cancellable = api.observe().sink{ event in
497497
if(event != ProviderEvent.ready){
498-
XCTFail("If OFREP API returns a 200 we should receive a ready event, received: \(event)")
498+
XCTFail("If OFREP API returns a 200 we should receive a ready event, received: \(String(describing: event)))")
499499
}
500500
expectation.fulfill()
501501
}
502502
await api.setProviderAndWait(provider: provider, initialContext: defaultEvaluationContext)
503503
await fulfillment(of: [expectation], timeout: 3)
504+
cancellable.cancel()
504505

505506
let client = api.getClient()
506507
let details = client.getIntegerDetails(key: "int-flag", defaultValue: 1)
@@ -528,7 +529,7 @@ class ProviderTests: XCTestCase {
528529
let expectation = XCTestExpectation(description: "waiting 1st event")
529530
let cancellable = api.observe().sink{ event in
530531
if(event != ProviderEvent.ready){
531-
XCTFail("If OFREP API returns a 200 we should receive a ready event, received: \(event)")
532+
XCTFail("If OFREP API returns a 200 we should receive a ready event, received: \(String(describing: event)))")
532533
}
533534
expectation.fulfill()
534535
}
@@ -559,7 +560,7 @@ class ProviderTests: XCTestCase {
559560
let expectation = XCTestExpectation(description: "waiting 1st event")
560561
let cancellable = api.observe().sink{ event in
561562
if(event != ProviderEvent.ready){
562-
XCTFail("If OFREP API returns a 200 we should receive a ready event, received: \(event)")
563+
XCTFail("If OFREP API returns a 200 we should receive a ready event, received: \(String(describing: event)))")
563564
}
564565
expectation.fulfill()
565566
}
@@ -590,7 +591,7 @@ class ProviderTests: XCTestCase {
590591
let expectation = XCTestExpectation(description: "waiting 1st event")
591592
let cancellable = api.observe().sink{ event in
592593
if(event != ProviderEvent.ready){
593-
XCTFail("If OFREP API returns a 200 we should receive a ready event, received: \(event)")
594+
XCTFail("If OFREP API returns a 200 we should receive a ready event, received: \(String(describing: event)))")
594595
}
595596
expectation.fulfill()
596597
}
@@ -621,7 +622,7 @@ class ProviderTests: XCTestCase {
621622
let expectation = XCTestExpectation(description: "waiting 1st event")
622623
let cancellable = api.observe().sink{ event in
623624
if(event != ProviderEvent.ready){
624-
XCTFail("If OFREP API returns a 200 we should receive a ready event, received: \(event)")
625+
XCTFail("If OFREP API returns a 200 we should receive a ready event, received: \(String(describing: event)))")
625626
}
626627
expectation.fulfill()
627628
}
@@ -652,7 +653,7 @@ class ProviderTests: XCTestCase {
652653
let expectation = XCTestExpectation(description: "waiting 1st event")
653654
let cancellable = api.observe().sink{ event in
654655
if(event != ProviderEvent.ready){
655-
XCTFail("If OFREP API returns a 200 we should receive a ready event, received: \(event)")
656+
XCTFail("If OFREP API returns a 200 we should receive a ready event, received: \(String(describing: event)))")
656657
}
657658
expectation.fulfill()
658659
}
@@ -677,7 +678,7 @@ class ProviderTests: XCTestCase {
677678
let expectation = XCTestExpectation(description: "waiting 1st event")
678679
let cancellable = api.observe().sink{ event in
679680
if(event != ProviderEvent.ready){
680-
XCTFail("If OFREP API returns a 200 we should receive a ready event, received: \(event)")
681+
XCTFail("If OFREP API returns a 200 we should receive a ready event, received: \(String(describing: event)))")
681682
}
682683
expectation.fulfill()
683684
}
@@ -702,7 +703,7 @@ class ProviderTests: XCTestCase {
702703
let expectation = XCTestExpectation(description: "waiting 1st event")
703704
let cancellable = api.observe().sink{ event in
704705
if(event != ProviderEvent.ready){
705-
XCTFail("If OFREP API returns a 200 we should receive a ready event, received: \(event)")
706+
XCTFail("If OFREP API returns a 200 we should receive a ready event, received: \(String(describing: event)))")
706707
}
707708
expectation.fulfill()
708709
}
@@ -727,7 +728,7 @@ class ProviderTests: XCTestCase {
727728
let expectation = XCTestExpectation(description: "waiting 1st event")
728729
let cancellable = api.observe().sink{ event in
729730
if(event != ProviderEvent.ready){
730-
XCTFail("If OFREP API returns a 200 we should receive a ready event, received: \(event)")
731+
XCTFail("If OFREP API returns a 200 we should receive a ready event, received: \(String(describing: event)))")
731732
}
732733
expectation.fulfill()
733734
}
@@ -752,7 +753,7 @@ class ProviderTests: XCTestCase {
752753
let expectation = XCTestExpectation(description: "waiting 1st event")
753754
let cancellable = api.observe().sink{ event in
754755
if(event != ProviderEvent.ready){
755-
XCTFail("If OFREP API returns a 200 we should receive a ready event, received: \(event)")
756+
XCTFail("If OFREP API returns a 200 we should receive a ready event, received: \(String(describing: event)))")
756757
}
757758
expectation.fulfill()
758759
}

0 commit comments

Comments
 (0)
Please sign in to comment.