From c11830d1811a99f5972edeb190181dabcc2a63a7 Mon Sep 17 00:00:00 2001 From: Prachi Gauriar Date: Thu, 19 Mar 2026 00:24:09 -0400 Subject: [PATCH] Fix compilation errors (and lint warnings) in Xcode 26.4 RC1 --- .../xcshareddata/xcschemes/dfob.xcscheme | 12 ++++++++ Scripts/format | 13 ++++++++ .../DispatchQueue+NonOvercommitting.swift | 4 +-- .../Concurrency/DispatchQueue+Standard.swift | 2 +- .../Concurrency/ExecutionGroup.swift | 4 +-- .../Concurrency/WithTimeout.swift | 2 +- .../ContextualBusEventObserver.swift | 10 +++---- .../Extensions/Data+Obfuscation.swift | 6 ++-- .../Networking/HTTP Client/HTTPClient.swift | 10 +++---- .../HTTP Client/HTTPClientInterceptor.swift | 2 +- .../Requests and Responses/HTTPResponse.swift | 6 ++-- .../BodyEqualsDecodable.swift | 4 +-- .../Responder.swift | 2 +- .../ResponseGenerator.swift | 30 +++++++++---------- .../SuccessResponseTemplate.swift | 6 ++-- .../Web Service Client/WebServiceClient.swift | 2 +- .../WebServiceRequest.swift | 2 +- .../Paging/SequentialPager.swift | 2 +- .../Bundle+RemoteContent.swift | 2 +- .../RemoteLocalizedString.swift | 2 +- .../Utility Types/ExpiringValue.swift | 4 +-- .../Utility Types/GibberishGenerator.swift | 8 ++--- .../Utility Types/JSONValue.swift | 6 ++-- .../Utility Types/RetryPolicy.swift | 10 +++---- .../RemoteLocalizedStringMacro.swift | 12 ++++---- ...RemoteLocalizedStringWithFormatMacro.swift | 16 +++++----- Sources/dfob/ObfuscateCommand.swift | 2 +- .../ScaledDateProviderTests.swift | 2 +- .../ContextualBusEventObserverTests.swift | 10 +++---- .../Event Bus/EventBusTests.swift | 4 +-- .../Extensions/Data+ObfuscationTests.swift | 22 +++++++------- .../Live Query/LiveQueryTests.swift | 12 ++++---- .../InvalidWebServiceRequestError.swift | 2 +- .../Errors/NonHTTPURLResponseErrorTests.swift | 2 +- .../HTTP Client/HTTPClientTests.swift | 12 ++++---- .../HTTP Client/URLRequestLoaderTests.swift | 6 ++-- .../HTTPHeaderItemTests.swift | 2 +- .../HTTPResponseTests.swift | 10 +++---- .../BodyEqualsDecodableTests.swift | 4 +-- .../Request Conditions/PathMatchesTests.swift | 12 ++++---- .../ResponderTests.swift | 20 ++++++------- .../ResponseGeneratorTests.swift | 14 ++++----- ...atedURLRequestLoaderIntegrationTests.swift | 20 ++++++------- .../SimulatedURLRequestLoaderTests.swift | 12 ++++---- .../SuccessResponseTemplateTests.swift | 8 ++--- .../JSONBodyWebServiceRequestTests.swift | 2 +- .../WebServiceClientTests.swift | 18 +++++------ .../WebServiceRequestTests.swift | 12 ++++---- .../Paging/RandomAccessPagerTests.swift | 4 +-- .../Paging/SequentialPagerTests.swift | 4 +-- .../Bundle+RemoteContentTests.swift | 3 +- .../RemoteLocalizedStringTests.swift | 2 +- .../Date+IsApproximatelyEqual.swift | 2 +- .../MockHTTPClientInterceptor.swift | 2 +- .../MockLiveQueryResultsProducer.swift | 1 - .../Testing Helpers/MockRetryPolicy.swift | 4 +-- .../MockWebServiceRequest.swift | 2 +- .../RandomValueGenerating+DevFoundation.swift | 6 ++-- .../Utility Types/ExpiringValueTests.swift | 4 +-- .../GibberishGeneratorTests.swift | 20 ++++++------- .../Utility Types/HashableByIDTests.swift | 6 ++-- .../IdentifiableBySelfTests.swift | 2 +- .../Utility Types/JSONValueTests.swift | 4 +-- .../Utility Types/RetryPolicyTests.swift | 28 ++++++++--------- .../Utility Types/TopLevelCodingTests.swift | 4 +-- Tests/dfobTests/ObfuscateCommandTests.swift | 2 +- 66 files changed, 256 insertions(+), 231 deletions(-) create mode 100755 Scripts/format diff --git a/.swiftpm/xcode/xcshareddata/xcschemes/dfob.xcscheme b/.swiftpm/xcode/xcshareddata/xcschemes/dfob.xcscheme index 735ebba..d97455b 100644 --- a/.swiftpm/xcode/xcshareddata/xcschemes/dfob.xcscheme +++ b/.swiftpm/xcode/xcshareddata/xcschemes/dfob.xcscheme @@ -34,6 +34,18 @@ default = "YES"> + + + + + + DispatchQueue { return .init( label: label, qos: qos, attributes: attributes, autoreleaseFrequency: autoreleaseFrequency, - target: .global(qos: qos.qosClass) + target: .global(qos: qos.qosClass), ) } } diff --git a/Sources/DevFoundation/Concurrency/DispatchQueue+Standard.swift b/Sources/DevFoundation/Concurrency/DispatchQueue+Standard.swift index 5d68444..da13963 100644 --- a/Sources/DevFoundation/Concurrency/DispatchQueue+Standard.swift +++ b/Sources/DevFoundation/Concurrency/DispatchQueue+Standard.swift @@ -14,6 +14,6 @@ extension DispatchQueue { /// queue uses `.utility` for its quality-of-service. public static let utility: DispatchQueue = .makeNonOvercommitting( label: reverseDNSPrefixed("utility"), - qos: .utility + qos: .utility, ) } diff --git a/Sources/DevFoundation/Concurrency/ExecutionGroup.swift b/Sources/DevFoundation/Concurrency/ExecutionGroup.swift index 365ccce..0910df4 100644 --- a/Sources/DevFoundation/Concurrency/ExecutionGroup.swift +++ b/Sources/DevFoundation/Concurrency/ExecutionGroup.swift @@ -83,7 +83,7 @@ public final class ExecutionGroup: Sendable { @discardableResult public func addTask( priority: TaskPriority? = nil, - operation: @escaping @Sendable @isolated(any) () async -> Success + operation: @escaping @Sendable @isolated(any) () async -> Success, ) -> Task { incrementTaskCount() @@ -103,7 +103,7 @@ public final class ExecutionGroup: Sendable { @discardableResult public func addTask( priority: TaskPriority? = nil, - operation: @escaping @Sendable @isolated(any) () async throws -> Success + operation: @escaping @Sendable @isolated(any) () async throws -> Success, ) -> Task where Success: Sendable { incrementTaskCount() diff --git a/Sources/DevFoundation/Concurrency/WithTimeout.swift b/Sources/DevFoundation/Concurrency/WithTimeout.swift index 932cbb3..aa22468 100644 --- a/Sources/DevFoundation/Concurrency/WithTimeout.swift +++ b/Sources/DevFoundation/Concurrency/WithTimeout.swift @@ -28,7 +28,7 @@ import Foundation public func withTimeout( _ timeout: Duration, priority: TaskPriority? = nil, - operation: @escaping @Sendable () async throws(Failure) -> Success + operation: @escaping @Sendable () async throws(Failure) -> Success, ) async throws -> Success where Success: Sendable, Failure: Error { let deadline = ContinuousClock.Instant.now + timeout diff --git a/Sources/DevFoundation/Event Bus/ContextualBusEventObserver.swift b/Sources/DevFoundation/Event Bus/ContextualBusEventObserver.swift index 5694f07..18147e2 100644 --- a/Sources/DevFoundation/Event Bus/ContextualBusEventObserver.swift +++ b/Sources/DevFoundation/Event Bus/ContextualBusEventObserver.swift @@ -52,7 +52,7 @@ public final class ContextualBusEventObserver: BusEventObserver where C @discardableResult public func addHandler( for eventType: Event.Type, - body: @escaping @Sendable (Event, inout Context) -> Void + body: @escaping @Sendable (Event, inout Context) -> Void, ) -> AnyObject where Event: BusEvent { let key = EventHandlerKey(eventType: eventType) let handler = Handler(body: body, eventID: nil) @@ -76,7 +76,7 @@ public final class ContextualBusEventObserver: BusEventObserver where C public func addHandler( for eventType: Event.Type, id: Event.ID, - body: @escaping @Sendable (Event, inout Context) -> Void + body: @escaping @Sendable (Event, inout Context) -> Void, ) -> AnyObject where Event: BusEvent & Identifiable, Event.ID: Sendable { let key = IdentifiableEventHandlerKey(eventType: eventType, eventID: id) let handler = Handler(body: body, eventID: AnySendableHashable(id)) @@ -252,7 +252,7 @@ extension ContextualBusEventObserver { /// - The event ID with which the handler was added. init( body: @escaping @Sendable (Event, inout Context) -> Void, - eventID: AnySendableHashable? + eventID: AnySendableHashable?, ) { self.body = body self.eventID = eventID @@ -283,7 +283,7 @@ extension ContextualBusEventObserver { /// The serial executor on which this actor’s jobs are executed. private let serialExecutor = DispatchSerialQueue( label: reverseDNSPrefixed("contextual-bus-event-observer"), - target: .utility + target: .utility, ) @@ -308,7 +308,7 @@ extension ContextualBusEventObserver { nonisolated var unownedExecutor: UnownedSerialExecutor { - return .init(serialExecutor) + return .init(complexEquality: serialExecutor) } } } diff --git a/Sources/DevFoundation/Extensions/Data+Obfuscation.swift b/Sources/DevFoundation/Extensions/Data+Obfuscation.swift index ebb8a5c..9098a93 100644 --- a/Sources/DevFoundation/Extensions/Data+Obfuscation.swift +++ b/Sources/DevFoundation/Extensions/Data+Obfuscation.swift @@ -22,7 +22,7 @@ extension Data { public func obfuscated( withKey key: Data, keySizeType: KeySize.Type, - messageSizeType: MessageSize.Type + messageSizeType: MessageSize.Type, ) throws -> Data where KeySize: FixedWidthInteger, @@ -55,7 +55,7 @@ extension Data { /// - messageSizeType: The message size type used to obfuscate the data. public func deobfuscated( keySizeType: KeySize.Type, - messageSizeType: MessageSize.Type + messageSizeType: MessageSize.Type, ) throws -> Data where KeySize: FixedWidthInteger & Sendable, @@ -88,7 +88,7 @@ extension Data { /// be extracted. private func extractFieldData( at index: Int, - sizeType: FieldSize.Type + sizeType: FieldSize.Type, ) -> (Data, Int)? where FieldSize: FixedWidthInteger & Sendable { let fieldSizeEndIndex = index + FieldSize.byteWidth diff --git a/Sources/DevFoundation/Networking/HTTP Client/HTTPClient.swift b/Sources/DevFoundation/Networking/HTTP Client/HTTPClient.swift index 16053a3..3940fec 100644 --- a/Sources/DevFoundation/Networking/HTTP Client/HTTPClient.swift +++ b/Sources/DevFoundation/Networking/HTTP Client/HTTPClient.swift @@ -47,7 +47,7 @@ public final class HTTPClient: Sendable where RequestContext: Se public init( urlRequestLoader: any URLRequestLoader, interceptors: [any HTTPClientInterceptor] = [], - retryPolicy: (any RetryPolicy<(URLRequest, RequestContext), Result, any Error>>)? = nil + retryPolicy: (any RetryPolicy<(URLRequest, RequestContext), Result, any Error>>)? = nil, ) { self.urlRequestLoader = urlRequestLoader self.interceptors = interceptors @@ -90,7 +90,7 @@ public final class HTTPClient: Sendable where RequestContext: Se _ urlRequest: URLRequest, context: RequestContext, attemptCount: Int, - initialDelay: Duration + initialDelay: Duration, ) async throws -> HTTPResponse { if initialDelay != .zero { try Task.checkCancellation() @@ -107,7 +107,7 @@ public final class HTTPClient: Sendable where RequestContext: Se forInput: (urlRequest, context), output: result, attemptCount: attemptCount, - previousDelay: initialDelay + previousDelay: initialDelay, ) else { return try result.get() @@ -131,7 +131,7 @@ public final class HTTPClient: Sendable where RequestContext: Se private func load( _ urlRequest: URLRequest, context: RequestContext, - interceptorIndex: Int + interceptorIndex: Int, ) async throws -> HTTPResponse { // If we’re out of interceptors, load the data guard interceptorIndex < interceptors.endIndex else { @@ -147,7 +147,7 @@ public final class HTTPClient: Sendable where RequestContext: Se // Otherwise, pass the interceptor our data and call the next one return try await interceptors[interceptorIndex].intercept( request: urlRequest, - context: context + context: context, ) { (request, context) in return try await load(request, context: context, interceptorIndex: interceptorIndex + 1) } diff --git a/Sources/DevFoundation/Networking/HTTP Client/HTTPClientInterceptor.swift b/Sources/DevFoundation/Networking/HTTP Client/HTTPClientInterceptor.swift index 65cd5a6..76e784a 100644 --- a/Sources/DevFoundation/Networking/HTTP Client/HTTPClientInterceptor.swift +++ b/Sources/DevFoundation/Networking/HTTP Client/HTTPClientInterceptor.swift @@ -29,6 +29,6 @@ public protocol HTTPClientInterceptor: Sendable { next: ( _ request: URLRequest, _ context: RequestContext - ) async throws -> HTTPResponse + ) async throws -> HTTPResponse, ) async throws -> HTTPResponse } diff --git a/Sources/DevFoundation/Networking/Requests and Responses/HTTPResponse.swift b/Sources/DevFoundation/Networking/Requests and Responses/HTTPResponse.swift index 6b01dce..f23edec 100644 --- a/Sources/DevFoundation/Networking/Requests and Responses/HTTPResponse.swift +++ b/Sources/DevFoundation/Networking/Requests and Responses/HTTPResponse.swift @@ -40,7 +40,7 @@ public struct HTTPResponse { ) throws(ErrorType) -> HTTPResponse { return HTTPResponse( httpURLResponse: httpURLResponse, - body: try transform(body) + body: try transform(body), ) } } @@ -106,7 +106,7 @@ extension HTTPResponse where Body == Data { /// - Throws: Throws any errors that occur during decoding. public func decode( _ type: Value.Type, - decoder: some TopLevelDecoder + decoder: some TopLevelDecoder, ) throws -> HTTPResponse where Value: Decodable { return try mapBody { (body) in @@ -126,7 +126,7 @@ extension HTTPResponse where Body == Data { public func decode( _ type: Value.Type, decoder: some TopLevelDecoder, - topLevelKey: Key + topLevelKey: Key, ) throws -> HTTPResponse where Value: Decodable, Key: CodingKey { return try mapBody { (body) in diff --git a/Sources/DevFoundation/Networking/Simulated URL Request Loader/Request Conditions/BodyEqualsDecodable.swift b/Sources/DevFoundation/Networking/Simulated URL Request Loader/Request Conditions/BodyEqualsDecodable.swift index ad25659..9bf9149 100644 --- a/Sources/DevFoundation/Networking/Simulated URL Request Loader/Request Conditions/BodyEqualsDecodable.swift +++ b/Sources/DevFoundation/Networking/Simulated URL Request Loader/Request Conditions/BodyEqualsDecodable.swift @@ -58,13 +58,13 @@ where Self == SimulatedURLRequestLoader.RequestConditions.AnyRequestCondition { /// - Returns: The new request condition. public static func bodyEquals( _ body: Body, - decoder: any TopLevelDecoder & Sendable = JSONDecoder() + decoder: any TopLevelDecoder & Sendable = JSONDecoder(), ) -> Self where Body: Decodable & Equatable & Sendable { return .init( SimulatedURLRequestLoader.RequestConditions.BodyEqualsDecodable( body: body, - decoder: decoder + decoder: decoder, ) ) } diff --git a/Sources/DevFoundation/Networking/Simulated URL Request Loader/Responder.swift b/Sources/DevFoundation/Networking/Simulated URL Request Loader/Responder.swift index 56d0e9a..3afb771 100644 --- a/Sources/DevFoundation/Networking/Simulated URL Request Loader/Responder.swift +++ b/Sources/DevFoundation/Networking/Simulated URL Request Loader/Responder.swift @@ -77,7 +77,7 @@ extension SimulatedURLRequestLoader { public init( requestConditions: [any RequestCondition], responseGenerator: any ResponseGenerator, - maxResponses: Int? = 1 + maxResponses: Int? = 1, ) { self.requestConditions = requestConditions self.responseGenerator = responseGenerator diff --git a/Sources/DevFoundation/Networking/Simulated URL Request Loader/ResponseGenerator.swift b/Sources/DevFoundation/Networking/Simulated URL Request Loader/ResponseGenerator.swift index ea39493..b5143c5 100644 --- a/Sources/DevFoundation/Networking/Simulated URL Request Loader/ResponseGenerator.swift +++ b/Sources/DevFoundation/Networking/Simulated URL Request Loader/ResponseGenerator.swift @@ -80,15 +80,15 @@ extension SimulatedURLRequestLoader { with error: any Error, delay: Duration = .zero, maxResponses: Int? = 1, - when requestConditions: [any RequestCondition] + when requestConditions: [any RequestCondition], ) -> some Responder { let responder = Responder( requestConditions: requestConditions, responseGenerator: FixedResponseGenerator( result: .failure(error), - delay: delay + delay: delay, ), - maxResponses: maxResponses + maxResponses: maxResponses, ) add(responder) return responder @@ -112,7 +112,7 @@ extension SimulatedURLRequestLoader { body: Data, delay: Duration = .zero, maxResponses: Int? = 1, - when requestConditions: [any RequestCondition] + when requestConditions: [any RequestCondition], ) -> some Responder { let responder = Responder( requestConditions: requestConditions, @@ -121,12 +121,12 @@ extension SimulatedURLRequestLoader { SuccessResponseTemplate( statusCode: statusCode, headerItems: headerItems, - body: body + body: body, ) ), - delay: delay + delay: delay, ), - maxResponses: maxResponses + maxResponses: maxResponses, ) add(responder) return responder @@ -152,7 +152,7 @@ extension SimulatedURLRequestLoader { encoding: String.Encoding = .utf8, delay: Duration = .zero, maxResponses: Int? = 1, - when requestConditions: [any RequestCondition] + when requestConditions: [any RequestCondition], ) -> some Responder { let responder = Responder( requestConditions: requestConditions, @@ -161,12 +161,12 @@ extension SimulatedURLRequestLoader { SuccessResponseTemplate( statusCode: statusCode, headerItems: headerItems, - body: body.data(using: encoding)! + body: body.data(using: encoding)!, ) ), - delay: delay + delay: delay, ), - maxResponses: maxResponses + maxResponses: maxResponses, ) add(responder) return responder @@ -194,7 +194,7 @@ extension SimulatedURLRequestLoader { encoder: any TopLevelEncoder = JSONEncoder(), delay: Duration = .zero, maxResponses: Int? = 1, - when requestConditions: [any RequestCondition] + when requestConditions: [any RequestCondition], ) -> some Responder where Body: Encodable { let responder = Responder( @@ -204,12 +204,12 @@ extension SimulatedURLRequestLoader { SuccessResponseTemplate( statusCode: statusCode, headerItems: headerItems, - body: try! encoder.encode(body) + body: try! encoder.encode(body), ) ), - delay: delay + delay: delay, ), - maxResponses: maxResponses + maxResponses: maxResponses, ) add(responder) return responder diff --git a/Sources/DevFoundation/Networking/Simulated URL Request Loader/SuccessResponseTemplate.swift b/Sources/DevFoundation/Networking/Simulated URL Request Loader/SuccessResponseTemplate.swift index f97396c..06b5b07 100644 --- a/Sources/DevFoundation/Networking/Simulated URL Request Loader/SuccessResponseTemplate.swift +++ b/Sources/DevFoundation/Networking/Simulated URL Request Loader/SuccessResponseTemplate.swift @@ -36,7 +36,7 @@ extension SimulatedURLRequestLoader { public init( statusCode: HTTPStatusCode, headerItems: Set, - body: Data + body: Data, ) { self.statusCode = statusCode self.headerItems = headerItems @@ -58,8 +58,8 @@ extension SimulatedURLRequestLoader { httpVersion: nil, headerFields: Dictionary( headerItems.map { ($0.field.rawValue, $0.value) }, - uniquingKeysWith: { $1 } - ) + uniquingKeysWith: { $1 }, + ), )! return (body, httpURLResponse) diff --git a/Sources/DevFoundation/Networking/Web Service Client/WebServiceClient.swift b/Sources/DevFoundation/Networking/Web Service Client/WebServiceClient.swift index f96b78d..623715a 100644 --- a/Sources/DevFoundation/Networking/Web Service Client/WebServiceClient.swift +++ b/Sources/DevFoundation/Networking/Web Service Client/WebServiceClient.swift @@ -65,7 +65,7 @@ where BaseURLConfiguration: BaseURLConfiguring, RequestContext: Sendable { let urlRequest = try request.urlRequest(with: baseURLConfiguration) let response = try await httpClient.load( urlRequest, - context: request.context + context: request.context, ) return try request.mapResponse(response) } diff --git a/Sources/DevFoundation/Networking/Web Service Client/WebServiceRequest.swift b/Sources/DevFoundation/Networking/Web Service Client/WebServiceRequest.swift index 42bd5a9..594d773 100644 --- a/Sources/DevFoundation/Networking/Web Service Client/WebServiceRequest.swift +++ b/Sources/DevFoundation/Networking/Web Service Client/WebServiceRequest.swift @@ -159,7 +159,7 @@ extension WebServiceRequest { } catch { throw InvalidWebServiceRequestError( debugDescription: "could not create the request’s HTTP body", - underlyingError: error + underlyingError: error, ) } diff --git a/Sources/DevFoundation/Paging/SequentialPager.swift b/Sources/DevFoundation/Paging/SequentialPager.swift index d0e5d92..08f5f75 100644 --- a/Sources/DevFoundation/Paging/SequentialPager.swift +++ b/Sources/DevFoundation/Paging/SequentialPager.swift @@ -78,7 +78,7 @@ public final class SequentialPager: SequentialPaging where Page: OffsetPag public init(pageLoader: some SequentialPageLoader, loadedPages: [Page] = []) { precondition( loadedPages.enumerated().allSatisfy { (index, page) in page.pageOffset == index }, - "loaded pages must start at offset 0 and be consecutive" + "loaded pages must start at offset 0 and be consecutive", ) self.pageLoader = pageLoader diff --git a/Sources/DevFoundation/Remote Localization/Bundle+RemoteContent.swift b/Sources/DevFoundation/Remote Localization/Bundle+RemoteContent.swift index 64ed37d..432624c 100644 --- a/Sources/DevFoundation/Remote Localization/Bundle+RemoteContent.swift +++ b/Sources/DevFoundation/Remote Localization/Bundle+RemoteContent.swift @@ -40,7 +40,7 @@ extension Bundle { /// - localizedStrings: The localized strings to store in the bundle. public static func makeRemoteContentBundle( at bundleURL: URL, - localizedStrings: [String: String] + localizedStrings: [String: String], ) throws -> Bundle? { // We write directly into the resources directory rather than putting it in an lproj, as we don’t actually // know language the strings are in. diff --git a/Sources/DevFoundation/Remote Localization/RemoteLocalizedString.swift b/Sources/DevFoundation/Remote Localization/RemoteLocalizedString.swift index cc7f3c3..c56ba4e 100644 --- a/Sources/DevFoundation/Remote Localization/RemoteLocalizedString.swift +++ b/Sources/DevFoundation/Remote Localization/RemoteLocalizedString.swift @@ -25,7 +25,7 @@ public func remoteLocalizedString( _ keyAndValue: String.LocalizationValue, key: String, bundle: Bundle, - remoteContentBundle: Bundle? = .defaultRemoteContentBundle + remoteContentBundle: Bundle? = .defaultRemoteContentBundle, ) -> String { if let remoteContentBundle { let value = String(localized: keyAndValue, bundle: remoteContentBundle) diff --git a/Sources/DevFoundation/Utility Types/ExpiringValue.swift b/Sources/DevFoundation/Utility Types/ExpiringValue.swift index 9e668cd..c0d1931 100644 --- a/Sources/DevFoundation/Utility Types/ExpiringValue.swift +++ b/Sources/DevFoundation/Utility Types/ExpiringValue.swift @@ -43,7 +43,7 @@ public struct ExpiringValue { public init( _ value: Value, dateProvider: any DateProvider = DateProviders.current, - lifetimeDuration: Duration + lifetimeDuration: Duration, ) { let now = dateProvider.now self.value = value @@ -62,7 +62,7 @@ public struct ExpiringValue { public init( _ value: Value, dateProvider: any DateProvider = DateProviders.current, - lifetimeDuration: TimeInterval + lifetimeDuration: TimeInterval, ) { self.init(value, dateProvider: dateProvider, lifetimeDuration: .seconds(lifetimeDuration)) } diff --git a/Sources/DevFoundation/Utility Types/GibberishGenerator.swift b/Sources/DevFoundation/Utility Types/GibberishGenerator.swift index d02c098..7d3f3d3 100644 --- a/Sources/DevFoundation/Utility Types/GibberishGenerator.swift +++ b/Sources/DevFoundation/Utility Types/GibberishGenerator.swift @@ -71,11 +71,11 @@ public struct GibberishGenerator: Sendable { sentenceSeparator: String, sentenceTemplates: [String], templateWordToken: String, - words: [String] + words: [String], ) { precondition( preferredSentencesPerParagraphRange.lowerBound > 0, - "preferredSentencesPerParagraphRange must have a positive lower bound" + "preferredSentencesPerParagraphRange must have a positive lower bound", ) precondition(!sentenceTemplates.isEmpty, "sentenceTemplates must be non-empty") precondition(!templateWordToken.isEmpty, "templateWordToken must be non-empty") @@ -171,7 +171,7 @@ public struct GibberishGenerator: Sendable { /// - Returns: A sentence using a template and words from the generator’s lexicon. public func generateParagraph( using randomNumberGenerator: inout some RandomNumberGenerator, - sentenceCount: Int? = nil + sentenceCount: Int? = nil, ) -> String { // swift-format-ignore let sentenceCount = sentenceCount ?? Int.random( @@ -315,7 +315,7 @@ extension GibberishGenerator { "volut", "volutpat", "vulla", "vullam", "vullan", "vullandigna", "vullandio", "vulluptat", "vulluptatet", "vulluptatum", "vulput", "vulputat", "vulputate", "vulpute", "wis", "wiscinim", "wisi", "wisis", "wisl", "wismod", "wismodi", "wismoloreet", "wisse", "xer", - ] + ], ) return GibberishGenerator(lexicon: latinLexicon) diff --git a/Sources/DevFoundation/Utility Types/JSONValue.swift b/Sources/DevFoundation/Utility Types/JSONValue.swift index 9bb2bf5..16ae0f1 100644 --- a/Sources/DevFoundation/Utility Types/JSONValue.swift +++ b/Sources/DevFoundation/Utility Types/JSONValue.swift @@ -129,8 +129,8 @@ extension JSONValue: Codable { self, .init( codingPath: encoder.codingPath, - debugDescription: "Cannot encode .ifPresent outside of a JSON collection" - ) + debugDescription: "Cannot encode .ifPresent outside of a JSON collection", + ), ) case .null: var container = encoder.singleValueContainer() @@ -169,7 +169,7 @@ extension JSONValue.Number: Codable { throw DecodingError.dataCorrupted( .init( codingPath: decoder.codingPath, - debugDescription: "Invalid JSON number" + debugDescription: "Invalid JSON number", ) ) } diff --git a/Sources/DevFoundation/Utility Types/RetryPolicy.swift b/Sources/DevFoundation/Utility Types/RetryPolicy.swift index 2d66de9..0546545 100644 --- a/Sources/DevFoundation/Utility Types/RetryPolicy.swift +++ b/Sources/DevFoundation/Utility Types/RetryPolicy.swift @@ -37,7 +37,7 @@ public protocol RetryPolicy: Sendable { forInput input: Input, output: Output, attemptCount: Int, - previousDelay: Duration? + previousDelay: Duration?, ) -> Duration? } @@ -73,7 +73,7 @@ public struct PredefinedDelaySequenceRetryPolicy: RetryPolicy { public init( delays: [Duration], maxRetries: Int? = nil, - retryPredicate: @escaping @Sendable (Input, Output) -> Bool + retryPredicate: @escaping @Sendable (Input, Output) -> Bool, ) { self.delays = delays self.maxRetries = maxRetries ?? delays.count @@ -85,7 +85,7 @@ public struct PredefinedDelaySequenceRetryPolicy: RetryPolicy { forInput input: Input, output: Output, attemptCount: Int, - previousDelay: Duration? + previousDelay: Duration?, ) -> Duration? { guard attemptCount <= maxRetries, retryPredicate(input, output) else { return nil @@ -118,14 +118,14 @@ public struct AggregateRetryPolicy: RetryPolicy { forInput input: Input, output: Output, attemptCount: Int, - previousDelay: Duration? + previousDelay: Duration?, ) -> Duration? { for policy in policies { if let delay = policy.retryDelay( forInput: input, output: output, attemptCount: attemptCount, - previousDelay: previousDelay + previousDelay: previousDelay, ) { return delay } diff --git a/Sources/RemoteLocalizationMacros/RemoteLocalizedStringMacro.swift b/Sources/RemoteLocalizationMacros/RemoteLocalizedStringMacro.swift index 6356e93..438d482 100644 --- a/Sources/RemoteLocalizationMacros/RemoteLocalizedStringMacro.swift +++ b/Sources/RemoteLocalizationMacros/RemoteLocalizedStringMacro.swift @@ -12,7 +12,7 @@ import SwiftSyntaxMacros public struct RemoteLocalizedStringMacro: ExpressionMacro { public static func expansion( of node: some FreestandingMacroExpansionSyntax, - in context: some MacroExpansionContext + in context: some MacroExpansionContext, ) throws -> ExprSyntax { guard let firstArgument = node.arguments.first, @@ -32,7 +32,7 @@ public struct RemoteLocalizedStringMacro: ExpressionMacro { argumentsArray.append( LabeledExprSyntax( expression: ExprSyntax(StringLiteralExprSyntax(content: keyString)), - trailingComma: .commaToken() + trailingComma: .commaToken(), ) ) @@ -42,7 +42,7 @@ public struct RemoteLocalizedStringMacro: ExpressionMacro { label: .identifier("key"), colon: .colonToken(), expression: ExprSyntax(StringLiteralExprSyntax(content: keyString)), - trailingComma: .commaToken() + trailingComma: .commaToken(), ) ) @@ -60,7 +60,7 @@ public struct RemoteLocalizedStringMacro: ExpressionMacro { macroName: .identifier("bundle"), leftParen: .leftParenToken(), arguments: LabeledExprListSyntax([]), - rightParen: .rightParenToken() + rightParen: .rightParenToken(), ) ) } @@ -69,7 +69,7 @@ public struct RemoteLocalizedStringMacro: ExpressionMacro { LabeledExprSyntax( label: .identifier("bundle"), colon: .colonToken(), - expression: bundleExpression + expression: bundleExpression, ) ) @@ -80,7 +80,7 @@ public struct RemoteLocalizedStringMacro: ExpressionMacro { calledExpression: DeclReferenceExprSyntax(baseName: .identifier("remoteLocalizedString")), leftParen: .leftParenToken(), arguments: arguments, - rightParen: .rightParenToken() + rightParen: .rightParenToken(), ) ) } diff --git a/Sources/RemoteLocalizationMacros/RemoteLocalizedStringWithFormatMacro.swift b/Sources/RemoteLocalizationMacros/RemoteLocalizedStringWithFormatMacro.swift index 4ebf4ec..8aa6cc1 100644 --- a/Sources/RemoteLocalizationMacros/RemoteLocalizedStringWithFormatMacro.swift +++ b/Sources/RemoteLocalizationMacros/RemoteLocalizedStringWithFormatMacro.swift @@ -13,7 +13,7 @@ import SwiftSyntaxMacros public struct RemoteLocalizedStringWithFormatMacro: ExpressionMacro { public static func expansion( of node: some FreestandingMacroExpansionSyntax, - in context: some MacroExpansionContext + in context: some MacroExpansionContext, ) throws -> ExprSyntax { guard let formatArgument = node.arguments.first(where: { $0.label?.text == "format" }), @@ -38,12 +38,12 @@ public struct RemoteLocalizedStringWithFormatMacro: ExpressionMacro { localizedStringArguments = [ LabeledExprSyntax( expression: ExprSyntax(StringLiteralExprSyntax(content: keyString)), - trailingComma: .commaToken() + trailingComma: .commaToken(), ), LabeledExprSyntax( label: .identifier("bundle"), colon: .colonToken(), - expression: bundleArgument.expression + expression: bundleArgument.expression, ), ] } else { @@ -59,13 +59,13 @@ public struct RemoteLocalizedStringWithFormatMacro: ExpressionMacro { macroName: .identifier("remoteLocalizedString"), leftParen: .leftParenToken(), arguments: LabeledExprListSyntax(localizedStringArguments), - rightParen: .rightParenToken() + rightParen: .rightParenToken(), ) argumentsArray.append( LabeledExprSyntax( expression: ExprSyntax(localizedStringCall), - trailingComma: .commaToken() + trailingComma: .commaToken(), ) ) @@ -80,7 +80,7 @@ public struct RemoteLocalizedStringWithFormatMacro: ExpressionMacro { argumentsArray.append( LabeledExprSyntax( expression: argument.expression, - trailingComma: trailingComma + trailingComma: trailingComma, ) ) } @@ -91,11 +91,11 @@ public struct RemoteLocalizedStringWithFormatMacro: ExpressionMacro { FunctionCallExprSyntax( calledExpression: MemberAccessExprSyntax( base: DeclReferenceExprSyntax(baseName: .identifier("String")), - name: .identifier("localizedStringWithFormat") + name: .identifier("localizedStringWithFormat"), ), leftParen: .leftParenToken(), arguments: arguments, - rightParen: .rightParenToken() + rightParen: .rightParenToken(), ) ) } diff --git a/Sources/dfob/ObfuscateCommand.swift b/Sources/dfob/ObfuscateCommand.swift index d4c3968..9c6a2b9 100644 --- a/Sources/dfob/ObfuscateCommand.swift +++ b/Sources/dfob/ObfuscateCommand.swift @@ -94,7 +94,7 @@ struct ObfuscateCommand: AsyncParsableCommand { case .deobfuscate: let deobfuscatedData = try inputData.deobfuscated( keySizeType: UInt8.self, - messageSizeType: UInt32.self + messageSizeType: UInt32.self, ) try outputFileHandle.write(contentsOf: deobfuscatedData) case .obfuscate: diff --git a/Tests/DevFoundationTests/Date Providers/ScaledDateProviderTests.swift b/Tests/DevFoundationTests/Date Providers/ScaledDateProviderTests.swift index bf77d43..3cb4fec 100644 --- a/Tests/DevFoundationTests/Date Providers/ScaledDateProviderTests.swift +++ b/Tests/DevFoundationTests/Date Providers/ScaledDateProviderTests.swift @@ -48,7 +48,7 @@ struct ScaledDateProviderTests: RandomValueGenerating { #expect( scaledProvider.now.isApproximatelyEqual( to: baseStartDate.addingTimeInterval(elapsedTimeInterval * scale), - absoluteTolerance: 0.01 + absoluteTolerance: 0.01, ) ) } diff --git a/Tests/DevFoundationTests/Event Bus/ContextualBusEventObserverTests.swift b/Tests/DevFoundationTests/Event Bus/ContextualBusEventObserverTests.swift index df10ec6..13debcb 100644 --- a/Tests/DevFoundationTests/Event Bus/ContextualBusEventObserverTests.swift +++ b/Tests/DevFoundationTests/Event Bus/ContextualBusEventObserverTests.swift @@ -30,7 +30,7 @@ struct ContextualBusEventObserverTests: RandomValueGenerating { try await confirmation("handler is not called", expectedCount: 0) { (didCallHandler) in observer.addHandler( for: MockIdentifiableBusEvent.self, - id: randomInt(in: .min ... .max) + id: randomInt(in: .min ... .max), ) { (_, _) in didCallHandler() } @@ -47,7 +47,7 @@ struct ContextualBusEventObserverTests: RandomValueGenerating { observer.addHandler(for: MockBusEvent.self) { (_, _) in didCallHandler() } observer.addHandler( for: MockIdentifiableBusEvent.self, - id: randomInt(in: .min ..< 0) + id: randomInt(in: .min ..< 0), ) { (_, _) in didCallHandler() } @@ -55,7 +55,7 @@ struct ContextualBusEventObserverTests: RandomValueGenerating { eventBus.post( MockIdentifiableBusEvent( id: randomInt(in: 0 ... .max), - string: randomAlphanumericString() + string: randomAlphanumericString(), ) ) try await Task.sleep(for: .milliseconds(500)) @@ -142,7 +142,7 @@ struct ContextualBusEventObserverTests: RandomValueGenerating { try await confirmation("removed handler is not called", expectedCount: 0) { (didCallHandler) in let handler = observer.addHandler( for: MockIdentifiableBusEvent.self, - id: randomInt(in: .min ... .max) + id: randomInt(in: .min ... .max), ) { (event, context) in didCallHandler() } @@ -150,7 +150,7 @@ struct ContextualBusEventObserverTests: RandomValueGenerating { eventBus.post( MockIdentifiableBusEvent( id: randomInt(in: .min ... .max), - string: randomAlphanumericString() + string: randomAlphanumericString(), ) ) try await Task.sleep(for: .milliseconds(500)) diff --git a/Tests/DevFoundationTests/Event Bus/EventBusTests.swift b/Tests/DevFoundationTests/Event Bus/EventBusTests.swift index ee3a6c9..9ed74a0 100644 --- a/Tests/DevFoundationTests/Event Bus/EventBusTests.swift +++ b/Tests/DevFoundationTests/Event Bus/EventBusTests.swift @@ -49,7 +49,7 @@ struct EventBusTests: RandomValueGenerating { let identifiableBusEvents = Array(count: randomInt(in: 3 ... 5)) { MockIdentifiableBusEvent( id: randomInt(in: 0 ... .max), - string: randomAlphanumericString() + string: randomAlphanumericString(), ) } @@ -104,7 +104,7 @@ struct EventBusTests: RandomValueGenerating { // Post an event and make sure the same event is received multiple times let identifiableEvent = MockIdentifiableBusEvent( id: randomInt(in: .min ... .max), - string: randomAlphanumericString() + string: randomAlphanumericString(), ) eventBus.post(identifiableEvent) let identifiableArguments = try #require( diff --git a/Tests/DevFoundationTests/Extensions/Data+ObfuscationTests.swift b/Tests/DevFoundationTests/Extensions/Data+ObfuscationTests.swift index fbed625..c952c84 100644 --- a/Tests/DevFoundationTests/Extensions/Data+ObfuscationTests.swift +++ b/Tests/DevFoundationTests/Extensions/Data+ObfuscationTests.swift @@ -24,7 +24,7 @@ struct Data_ObfuscationTests: RandomValueGenerating { _ = try Data().obfuscated( withKey: Data(), keySizeType: UInt8.self, - messageSizeType: UInt64.self + messageSizeType: UInt64.self, ) } } @@ -39,7 +39,7 @@ struct Data_ObfuscationTests: RandomValueGenerating { let obfuscatedMessage = try message.obfuscated( withKey: key, keySizeType: Int8.self, - messageSizeType: Int16.self + messageSizeType: Int16.self, ) #expect(!obfuscatedMessage.contains(message)) @@ -47,7 +47,7 @@ struct Data_ObfuscationTests: RandomValueGenerating { let deobfuscatedMessage = try obfuscatedMessage.deobfuscated( keySizeType: Int8.self, - messageSizeType: Int16.self + messageSizeType: Int16.self, ) #expect(deobfuscatedMessage == message) @@ -60,7 +60,7 @@ struct Data_ObfuscationTests: RandomValueGenerating { _ = try randomData(count: 256).obfuscated( withKey: randomData(count: 32), keySizeType: UInt8.self, - messageSizeType: UInt8.self + messageSizeType: UInt8.self, ) } } @@ -72,7 +72,7 @@ struct Data_ObfuscationTests: RandomValueGenerating { _ = try randomData(count: 16).obfuscated( withKey: randomData(count: 256), keySizeType: UInt8.self, - messageSizeType: Int8.self + messageSizeType: Int8.self, ) } } @@ -83,13 +83,13 @@ struct Data_ObfuscationTests: RandomValueGenerating { let obfuscatedMessage = try randomData(count: 128).obfuscated( withKey: randomData(count: 32), keySizeType: UInt8.self, - messageSizeType: UInt8.self + messageSizeType: UInt8.self, ) #expect(throws: DataDeobfuscationError.invalidMessage) { _ = try obfuscatedMessage.deobfuscated( keySizeType: UInt8.self, - messageSizeType: UInt32.self + messageSizeType: UInt32.self, ) } } @@ -100,13 +100,13 @@ struct Data_ObfuscationTests: RandomValueGenerating { let obfuscatedMessage = try randomData(count: 128).obfuscated( withKey: randomData(count: 32), keySizeType: UInt8.self, - messageSizeType: UInt8.self + messageSizeType: UInt8.self, ) #expect(throws: DataDeobfuscationError.invalidKey) { _ = try obfuscatedMessage.deobfuscated( keySizeType: UInt16.self, - messageSizeType: UInt8.self + messageSizeType: UInt8.self, ) } } @@ -117,7 +117,7 @@ struct Data_ObfuscationTests: RandomValueGenerating { #expect(throws: DataDeobfuscationError.invalidMessage) { _ = try randomData(count: 1).deobfuscated( keySizeType: UInt16.self, - messageSizeType: UInt16.self + messageSizeType: UInt16.self, ) } } @@ -131,7 +131,7 @@ struct Data_ObfuscationTests: RandomValueGenerating { #expect(throws: DataDeobfuscationError.invalidKey) { _ = try data.deobfuscated( keySizeType: UInt8.self, - messageSizeType: Int.self + messageSizeType: Int.self, ) } } diff --git a/Tests/DevFoundationTests/Live Query/LiveQueryTests.swift b/Tests/DevFoundationTests/Live Query/LiveQueryTests.swift index 1df298a..374739b 100644 --- a/Tests/DevFoundationTests/Live Query/LiveQueryTests.swift +++ b/Tests/DevFoundationTests/Live Query/LiveQueryTests.swift @@ -139,14 +139,14 @@ struct LiveQueryTests: RandomValueGenerating { let canonicalFragment2 = randomAlphanumericString() resultsProducer.canonicalQueryFragmentStub = Stub( defaultReturnValue: canonicalFragment2, - returnValueQueue: [canonicalFragment1] + returnValueQueue: [canonicalFragment1], ) let initialResults = [randomAlphanumericString()] let expectedError = randomError() resultsProducer.resultsStub = ThrowingStub( defaultError: expectedError, - resultQueue: [.success(initialResults)] + resultQueue: [.success(initialResults)], ) let (signalStream, signaler) = AsyncStream.makeStream() @@ -185,14 +185,14 @@ struct LiveQueryTests: RandomValueGenerating { let canonicalFragment2 = randomAlphanumericString() resultsProducer.canonicalQueryFragmentStub = Stub( defaultReturnValue: canonicalFragment2, - returnValueQueue: [canonicalFragment1] + returnValueQueue: [canonicalFragment1], ) let expectedError = randomError() let newResults = [randomAlphanumericString()] resultsProducer.resultsStub = ThrowingStub( defaultReturnValue: newResults, - resultQueue: [.failure(expectedError)] + resultQueue: [.failure(expectedError)], ) let (signalStream, signaler) = AsyncStream.makeStream() @@ -232,7 +232,7 @@ struct LiveQueryTests: RandomValueGenerating { let canonicalFragment3 = randomAlphanumericString() resultsProducer.canonicalQueryFragmentStub = Stub( defaultReturnValue: canonicalFragment3, - returnValueQueue: [canonicalFragment1, canonicalFragment2] + returnValueQueue: [canonicalFragment1, canonicalFragment2], ) let results1 = [randomAlphanumericString()] @@ -240,7 +240,7 @@ struct LiveQueryTests: RandomValueGenerating { let results3 = [randomAlphanumericString()] resultsProducer.resultsStub = ThrowingStub( defaultReturnValue: results3, - resultQueue: [.success(results1), .success(results2)] + resultQueue: [.success(results1), .success(results2)], ) let (signalStream, signaler) = AsyncStream.makeStream() diff --git a/Tests/DevFoundationTests/Networking/Errors/InvalidWebServiceRequestError.swift b/Tests/DevFoundationTests/Networking/Errors/InvalidWebServiceRequestError.swift index 41abd6c..c3636f4 100644 --- a/Tests/DevFoundationTests/Networking/Errors/InvalidWebServiceRequestError.swift +++ b/Tests/DevFoundationTests/Networking/Errors/InvalidWebServiceRequestError.swift @@ -21,7 +21,7 @@ struct InvalidWebServiceRequestErrorTests: RandomValueGenerating { for underlyingError in [nil, randomError()] { let error = InvalidWebServiceRequestError( debugDescription: debugDescription, - underlyingError: underlyingError + underlyingError: underlyingError, ) #expect(error.debugDescription == debugDescription) #expect(error.underlyingError as? MockError == underlyingError) diff --git a/Tests/DevFoundationTests/Networking/Errors/NonHTTPURLResponseErrorTests.swift b/Tests/DevFoundationTests/Networking/Errors/NonHTTPURLResponseErrorTests.swift index d1ebd0b..6707090 100644 --- a/Tests/DevFoundationTests/Networking/Errors/NonHTTPURLResponseErrorTests.swift +++ b/Tests/DevFoundationTests/Networking/Errors/NonHTTPURLResponseErrorTests.swift @@ -24,7 +24,7 @@ struct NonHTTPURLResponseErrorTests: RandomValueGenerating { url: ftpURL, mimeType: nil, expectedContentLength: randomInt(in: 256 ... 1024), - textEncodingName: nil + textEncodingName: nil, ) let error = NonHTTPURLResponseError(urlResponse: urlResponse) diff --git a/Tests/DevFoundationTests/Networking/HTTP Client/HTTPClientTests.swift b/Tests/DevFoundationTests/Networking/HTTP Client/HTTPClientTests.swift index ff827e3..9174590 100644 --- a/Tests/DevFoundationTests/Networking/HTTP Client/HTTPClientTests.swift +++ b/Tests/DevFoundationTests/Networking/HTTP Client/HTTPClientTests.swift @@ -27,7 +27,7 @@ struct HTTPClientTests: RandomValueGenerating { let client = HTTPClient( urlRequestLoader: urlRequestLoader, interceptors: interceptors, - retryPolicy: retryPolicy + retryPolicy: retryPolicy, ) #expect(client.urlRequestLoader as? MockURLRequestLoader === urlRequestLoader) @@ -55,7 +55,7 @@ struct HTTPClientTests: RandomValueGenerating { urlRequestLoader.dataStub = ThrowingStub( defaultReturnValue: ( expectedResponse.body, - expectedResponse.httpURLResponse + expectedResponse.httpURLResponse, ) ) @@ -99,18 +99,18 @@ struct HTTPClientTests: RandomValueGenerating { urlRequestLoader.dataStub = ThrowingStub( defaultReturnValue: (successResponse.body, successResponse.httpURLResponse), - resultQueue: [.failure(randomError())] + resultQueue: [.failure(randomError())], ) let retryPolicy = TestRetryPolicy() retryPolicy.retryDelayStub = Stub( defaultReturnValue: nil, - returnValueQueue: [Duration.seconds(1)] + returnValueQueue: [Duration.seconds(1)], ) let client = HTTPClient( urlRequestLoader: urlRequestLoader, - retryPolicy: retryPolicy + retryPolicy: retryPolicy, ) let request = randomURLRequest() @@ -166,7 +166,7 @@ struct HTTPClientTests: RandomValueGenerating { url: randomURL(), mimeType: nil, expectedContentLength: randomInt(in: 100 ... 1000), - textEncodingName: nil + textEncodingName: nil, ) urlRequestLoader.dataStub = ThrowingStub(defaultReturnValue: (randomData(), nonHTTPResponse)) diff --git a/Tests/DevFoundationTests/Networking/HTTP Client/URLRequestLoaderTests.swift b/Tests/DevFoundationTests/Networking/HTTP Client/URLRequestLoaderTests.swift index 510d21e..01bf6c3 100644 --- a/Tests/DevFoundationTests/Networking/HTTP Client/URLRequestLoaderTests.swift +++ b/Tests/DevFoundationTests/Networking/HTTP Client/URLRequestLoaderTests.swift @@ -52,7 +52,7 @@ struct URLRequestLoaderTests: RandomValueGenerating { httpMethod: request.httpMethod!, url: request.url!, checksHeadersWhenMatching: false, - checksBodyWhenMatching: false + checksBodyWhenMatching: false, ) mockRequest.responder = UMKMockHTTPResponder(statusCode: expectedStatusCode, body: expectedBody) @@ -80,7 +80,7 @@ struct URLRequestLoaderTests: RandomValueGenerating { httpMethod: request.httpMethod!, url: request.url!, checksHeadersWhenMatching: false, - checksBodyWhenMatching: false + checksBodyWhenMatching: false, ) mockRequest.responder = UMKMockHTTPResponder(statusCode: expectedStatusCode, body: nil) @@ -108,7 +108,7 @@ struct URLRequestLoaderTests: RandomValueGenerating { httpMethod: request.httpMethod!, url: request.url!, checksHeadersWhenMatching: false, - checksBodyWhenMatching: false + checksBodyWhenMatching: false, ) mockRequest.responder = UMKMockHTTPResponder(error: expectedError) UMKMockURLProtocol.expectMockRequest(mockRequest) diff --git a/Tests/DevFoundationTests/Networking/Requests and Responses/HTTPHeaderItemTests.swift b/Tests/DevFoundationTests/Networking/Requests and Responses/HTTPHeaderItemTests.swift index d44c2ce..f4284f2 100644 --- a/Tests/DevFoundationTests/Networking/Requests and Responses/HTTPHeaderItemTests.swift +++ b/Tests/DevFoundationTests/Networking/Requests and Responses/HTTPHeaderItemTests.swift @@ -79,7 +79,7 @@ struct HTTPHeaderItemTests: RandomValueGenerating { url: randomURL(), statusCode: randomInt(in: 100 ..< 600), httpVersion: "1.1", - headerFields: [:] + headerFields: [:], )! let stringHeaders = Dictionary(count: randomInt(in: 3 ..< 10)) { diff --git a/Tests/DevFoundationTests/Networking/Requests and Responses/HTTPResponseTests.swift b/Tests/DevFoundationTests/Networking/Requests and Responses/HTTPResponseTests.swift index 025d84b..aeab308 100644 --- a/Tests/DevFoundationTests/Networking/Requests and Responses/HTTPResponseTests.swift +++ b/Tests/DevFoundationTests/Networking/Requests and Responses/HTTPResponseTests.swift @@ -101,12 +101,12 @@ struct HTTPResponseTests: RandomValueGenerating { array: Array(count: 5) { randomFloat64(in: 0 ... 100) }, bool: randomBool(), int: randomInt(in: -100 ... 100), - string: randomBasicLatinString() + string: randomBasicLatinString(), ) let response = HTTPResponse( httpURLResponse: randomHTTPURLResponse(), - body: try JSONEncoder().encode(mockCodable) + body: try JSONEncoder().encode(mockCodable), ) let decodedResponse = try response.decode(MockCodable.self, decoder: JSONDecoder()) @@ -130,18 +130,18 @@ struct HTTPResponseTests: RandomValueGenerating { array: Array(count: 5) { randomFloat64(in: 0 ... 100) }, bool: randomBool(), int: randomInt(in: -100 ... 100), - string: randomBasicLatinString() + string: randomBasicLatinString(), ) let response = HTTPResponse( httpURLResponse: randomHTTPURLResponse(), - body: try JSONEncoder().encode(mockCodable) + body: try JSONEncoder().encode(mockCodable), ) let decodedResponse = try response.decode( [Float64].self, decoder: JSONDecoder(), - topLevelKey: MockCodable.CodingKeys.array + topLevelKey: MockCodable.CodingKeys.array, ) #expect(decodedResponse == response.mapBody { _ in mockCodable.array }) } diff --git a/Tests/DevFoundationTests/Networking/Simulated URL Request Loader/Request Conditions/BodyEqualsDecodableTests.swift b/Tests/DevFoundationTests/Networking/Simulated URL Request Loader/Request Conditions/BodyEqualsDecodableTests.swift index 32c2b55..a793950 100644 --- a/Tests/DevFoundationTests/Networking/Simulated URL Request Loader/Request Conditions/BodyEqualsDecodableTests.swift +++ b/Tests/DevFoundationTests/Networking/Simulated URL Request Loader/Request Conditions/BodyEqualsDecodableTests.swift @@ -112,7 +112,7 @@ struct BodyEqualsDecodableTests: RandomValueGenerating { let decoder = PropertyListDecoder() let condition: SimulatedURLRequestLoader.RequestConditions.AnyRequestCondition = .bodyEquals( body, - decoder: decoder + decoder: decoder, ) let typedCondition = try #require( @@ -126,7 +126,7 @@ struct BodyEqualsDecodableTests: RandomValueGenerating { private mutating func randomBody() -> TestCodable { return TestCodable( id: randomInt(in: .min ... .max), - name: randomAlphanumericString() + name: randomAlphanumericString(), ) } } diff --git a/Tests/DevFoundationTests/Networking/Simulated URL Request Loader/Request Conditions/PathMatchesTests.swift b/Tests/DevFoundationTests/Networking/Simulated URL Request Loader/Request Conditions/PathMatchesTests.swift index aa5fc4e..5dffb16 100644 --- a/Tests/DevFoundationTests/Networking/Simulated URL Request Loader/Request Conditions/PathMatchesTests.swift +++ b/Tests/DevFoundationTests/Networking/Simulated URL Request Loader/Request Conditions/PathMatchesTests.swift @@ -21,7 +21,7 @@ struct PathMatchesTests: RandomValueGenerating { let condition = SimulatedURLRequestLoader.RequestConditions.PathMatches( pattern: pattern, - percentEncoded: percentEncoded + percentEncoded: percentEncoded, ) #expect(condition.percentEncoded == percentEncoded) @@ -32,7 +32,7 @@ struct PathMatchesTests: RandomValueGenerating { mutating func isFulfilledReturnsTrueWhenPathMatches() { let condition = SimulatedURLRequestLoader.RequestConditions.PathMatches( pattern: #//users/[0-9]+/#, - percentEncoded: false + percentEncoded: false, ) let urlRequest = URLRequest(url: URL(string: "https://api.example.com/users/123")!) let requestComponents = SimulatedURLRequestLoader.RequestComponents(urlRequest: urlRequest)! @@ -45,7 +45,7 @@ struct PathMatchesTests: RandomValueGenerating { mutating func isFulfilledReturnsFalseWhenPathDoesNotMatch() { let condition = SimulatedURLRequestLoader.RequestConditions.PathMatches( pattern: #//users/[0-9]+/#, - percentEncoded: false + percentEncoded: false, ) let urlRequest = URLRequest(url: URL(string: "https://api.example.com/posts/abc")!) let requestComponents = SimulatedURLRequestLoader.RequestComponents(urlRequest: urlRequest)! @@ -59,7 +59,7 @@ struct PathMatchesTests: RandomValueGenerating { let pattern = #//users/[0-9]+/# let condition = SimulatedURLRequestLoader.RequestConditions.PathMatches( pattern: pattern, - percentEncoded: true + percentEncoded: true, ) #expect(String(describing: condition) == ".pathMatches(*****, percentEncoded: true)") @@ -71,7 +71,7 @@ struct PathMatchesTests: RandomValueGenerating { let path = "/users/123" let condition: SimulatedURLRequestLoader.RequestConditions.PathMatches = .pathEquals( path, - percentEncoded: false + percentEncoded: false, ) #expect(condition.percentEncoded == false) @@ -88,7 +88,7 @@ struct PathMatchesTests: RandomValueGenerating { let pathPattern = #/.*api/v[0-9]+/users/# let condition: SimulatedURLRequestLoader.RequestConditions.PathMatches = .pathMatches( pathPattern, - percentEncoded: true + percentEncoded: true, ) #expect(condition.percentEncoded == true) diff --git a/Tests/DevFoundationTests/Networking/Simulated URL Request Loader/ResponderTests.swift b/Tests/DevFoundationTests/Networking/Simulated URL Request Loader/ResponderTests.swift index 45b867a..b508247 100644 --- a/Tests/DevFoundationTests/Networking/Simulated URL Request Loader/ResponderTests.swift +++ b/Tests/DevFoundationTests/Networking/Simulated URL Request Loader/ResponderTests.swift @@ -24,7 +24,7 @@ struct ResponderTests: RandomValueGenerating { let responder = SimulatedURLRequestLoader.Responder( requestConditions: requestConditions, responseGenerator: responseGenerator, - maxResponses: maxResponses + maxResponses: maxResponses, ) #expect(responder.requestConditions as? [MockRequestCondition] == requestConditions) @@ -42,7 +42,7 @@ struct ResponderTests: RandomValueGenerating { let responder = SimulatedURLRequestLoader.Responder( requestConditions: requestConditions, responseGenerator: responseGenerator, - maxResponses: maxResponses + maxResponses: maxResponses, ) #expect(!responder.isFulfilled) @@ -63,7 +63,7 @@ struct ResponderTests: RandomValueGenerating { let responder = SimulatedURLRequestLoader.Responder( requestConditions: requestConditions, responseGenerator: responseGenerator, - maxResponses: maxResponses + maxResponses: maxResponses, ) let requestComponents = try #require( @@ -91,7 +91,7 @@ struct ResponderTests: RandomValueGenerating { let responder = SimulatedURLRequestLoader.Responder( requestConditions: requestConditions, responseGenerator: responseGenerator, - maxResponses: nil + maxResponses: nil, ) let requestComponents = try #require( @@ -117,7 +117,7 @@ struct ResponderTests: RandomValueGenerating { let responder = SimulatedURLRequestLoader.Responder( requestConditions: requestConditions, responseGenerator: responseGenerator, - maxResponses: randomInt(in: 2 ... 5) + maxResponses: randomInt(in: 2 ... 5), ) let requestComponents = try #require( @@ -141,7 +141,7 @@ struct ResponderTests: RandomValueGenerating { let responder = SimulatedURLRequestLoader.Responder( requestConditions: requestConditions, responseGenerator: responseGenerator, - maxResponses: 0 + maxResponses: 0, ) let requestComponents = try #require( @@ -168,7 +168,7 @@ struct ResponderTests: RandomValueGenerating { let responder = SimulatedURLRequestLoader.Responder( requestConditions: requestConditions, responseGenerator: responseGenerator, - maxResponses: randomInt(in: 2 ... 5) + maxResponses: randomInt(in: 2 ... 5), ) let requestComponents = try #require( @@ -197,7 +197,7 @@ struct ResponderTests: RandomValueGenerating { let responder = SimulatedURLRequestLoader.Responder( requestConditions: requestConditions, responseGenerator: responseGenerator, - maxResponses: maxResponses + maxResponses: maxResponses, ) let requestComponents = try #require( @@ -241,7 +241,7 @@ struct ResponderTests: RandomValueGenerating { let responder = SimulatedURLRequestLoader.Responder( requestConditions: requestConditions, responseGenerator: responseGenerator, - maxResponses: randomInt(in: 2 ... 5) + maxResponses: randomInt(in: 2 ... 5), ) let requestComponents = try #require( @@ -270,7 +270,7 @@ struct ResponderTests: RandomValueGenerating { let responder = SimulatedURLRequestLoader.Responder( requestConditions: requestConditions, responseGenerator: responseGenerator, - maxResponses: 1 + maxResponses: 1, ) let requestComponents = try #require( diff --git a/Tests/DevFoundationTests/Networking/Simulated URL Request Loader/ResponseGeneratorTests.swift b/Tests/DevFoundationTests/Networking/Simulated URL Request Loader/ResponseGeneratorTests.swift index 1e26bd9..8e2da4d 100644 --- a/Tests/DevFoundationTests/Networking/Simulated URL Request Loader/ResponseGeneratorTests.swift +++ b/Tests/DevFoundationTests/Networking/Simulated URL Request Loader/ResponseGeneratorTests.swift @@ -25,11 +25,11 @@ struct ResponseGeneratorTests: RandomValueGenerating { let template = SimulatedURLRequestLoader.SuccessResponseTemplate( statusCode: statusCode, headerItems: headerItems, - body: body + body: body, ) let generator = SimulatedURLRequestLoader.FixedResponseGenerator( result: .success(template), - delay: delay + delay: delay, ) let requestComponents = try #require( @@ -56,7 +56,7 @@ struct ResponseGeneratorTests: RandomValueGenerating { let generator = SimulatedURLRequestLoader.FixedResponseGenerator( result: .failure(error), - delay: delay + delay: delay, ) let requestComponents = try #require( @@ -86,7 +86,7 @@ struct ResponseGeneratorTests: RandomValueGenerating { with: error, delay: delay, maxResponses: maxResponses, - when: requestConditions + when: requestConditions, ) #expect(loader.responders == [responder]) @@ -118,7 +118,7 @@ struct ResponseGeneratorTests: RandomValueGenerating { body: body, delay: delay, maxResponses: maxResponses, - when: requestConditions + when: requestConditions, ) #expect(loader.responders == [responder]) @@ -155,7 +155,7 @@ struct ResponseGeneratorTests: RandomValueGenerating { encoding: encoding, delay: delay, maxResponses: maxResponses, - when: requestConditions + when: requestConditions, ) #expect(loader.responders == [responder]) @@ -197,7 +197,7 @@ struct ResponseGeneratorTests: RandomValueGenerating { encoder: encoder, delay: delay, maxResponses: maxResponses, - when: requestConditions + when: requestConditions, ) let expectedBody = try encoder.encode(body) diff --git a/Tests/DevFoundationTests/Networking/Simulated URL Request Loader/SimulatedURLRequestLoaderIntegrationTests.swift b/Tests/DevFoundationTests/Networking/Simulated URL Request Loader/SimulatedURLRequestLoaderIntegrationTests.swift index 23b1976..0611a02 100644 --- a/Tests/DevFoundationTests/Networking/Simulated URL Request Loader/SimulatedURLRequestLoaderIntegrationTests.swift +++ b/Tests/DevFoundationTests/Networking/Simulated URL Request Loader/SimulatedURLRequestLoaderIntegrationTests.swift @@ -18,13 +18,13 @@ struct SimulatedURLRequestLoaderIntegrationTests: RandomValueGenerating { mutating func webServiceClientWithSimulatedURLRequestLoaderLoadsJSONRequest() async throws { let requestBody = TestRequestBody( name: randomAlphanumericString(), - age: randomInt(in: 1 ... 100) + age: randomInt(in: 1 ... 100), ) let expectedResponse = TestResponseBody( id: randomInt(in: 0 ... .max), message: randomAlphanumericString(), - active: randomBool() + active: randomBool(), ) let loader = SimulatedURLRequestLoader() @@ -34,12 +34,12 @@ struct SimulatedURLRequestLoaderIntegrationTests: RandomValueGenerating { when: [ .httpMethodEquals(.post), .pathMatches(#/.*/api/test/#, percentEncoded: false), - ] + ], ) let client = WebServiceClient( httpClient: HTTPClient(urlRequestLoader: loader), - baseURLConfiguration: SingleBaseURLConfiguration(baseURL: randomURL()) + baseURLConfiguration: SingleBaseURLConfiguration(baseURL: randomURL()), ) @@ -52,7 +52,7 @@ struct SimulatedURLRequestLoaderIntegrationTests: RandomValueGenerating { mutating func webServiceClientWithSimulatedURLRequestLoaderThrowsError() async throws { let requestBody = TestRequestBody( name: randomAlphanumericString(), - age: randomInt(in: 1 ... 100) + age: randomInt(in: 1 ... 100), ) let error = randomError() @@ -63,12 +63,12 @@ struct SimulatedURLRequestLoaderIntegrationTests: RandomValueGenerating { when: [ .httpMethodEquals(.post), .pathMatches(#/.*/api/test/#, percentEncoded: false), - ] + ], ) let client = WebServiceClient( httpClient: HTTPClient(urlRequestLoader: loader), - baseURLConfiguration: SingleBaseURLConfiguration(baseURL: randomURL()) + baseURLConfiguration: SingleBaseURLConfiguration(baseURL: randomURL()), ) let request = TestWebServiceRequest(jsonBody: requestBody) @@ -82,7 +82,7 @@ struct SimulatedURLRequestLoaderIntegrationTests: RandomValueGenerating { mutating func webServiceClientWithSimulatedURLRequestLoaderThrowsUnfulfillableError() async throws { let requestBody = TestRequestBody( name: randomAlphanumericString(), - age: randomInt(in: 1 ... 100) + age: randomInt(in: 1 ... 100), ) let error = randomError() @@ -90,12 +90,12 @@ struct SimulatedURLRequestLoaderIntegrationTests: RandomValueGenerating { let loader = SimulatedURLRequestLoader() loader.respond( with: error, - when: [.httpMethodEquals(.get)] + when: [.httpMethodEquals(.get)], ) let client = WebServiceClient( httpClient: HTTPClient(urlRequestLoader: loader), - baseURLConfiguration: SingleBaseURLConfiguration(baseURL: randomURL()) + baseURLConfiguration: SingleBaseURLConfiguration(baseURL: randomURL()), ) let request = TestWebServiceRequest(jsonBody: requestBody) diff --git a/Tests/DevFoundationTests/Networking/Simulated URL Request Loader/SimulatedURLRequestLoaderTests.swift b/Tests/DevFoundationTests/Networking/Simulated URL Request Loader/SimulatedURLRequestLoaderTests.swift index b865f3c..9b24d68 100644 --- a/Tests/DevFoundationTests/Networking/Simulated URL Request Loader/SimulatedURLRequestLoaderTests.swift +++ b/Tests/DevFoundationTests/Networking/Simulated URL Request Loader/SimulatedURLRequestLoaderTests.swift @@ -30,7 +30,7 @@ struct SimulatedURLRequestLoaderTests: RandomValueGenerating { let responder = SimulatedURLRequestLoader.Responder( requestConditions: [.httpMethodEquals(.get)], responseGenerator: mockResponseGenerator, - maxResponses: 1 + maxResponses: 1, ) loader.add(responder) @@ -61,7 +61,7 @@ struct SimulatedURLRequestLoaderTests: RandomValueGenerating { loader.respond( with: expectedStatusCode, body: expectedData, - when: [] + when: [], ) let (actualData, response) = try await loader.data(for: urlRequest) @@ -81,7 +81,7 @@ struct SimulatedURLRequestLoaderTests: RandomValueGenerating { loader.respond( with: expectedError, - when: [] + when: [], ) await #expect(throws: expectedError) { @@ -105,14 +105,14 @@ struct SimulatedURLRequestLoaderTests: RandomValueGenerating { loader.respond( with: statusCode1, body: data1, - when: [.httpMethodEquals(.post)] + when: [.httpMethodEquals(.post)], ) // Second responder matches GET requests loader.respond( with: statusCode2, body: data2, - when: [.httpMethodEquals(.get)] + when: [.httpMethodEquals(.get)], ) let (actualData, response) = try await loader.data(for: urlRequest) @@ -133,7 +133,7 @@ struct SimulatedURLRequestLoaderTests: RandomValueGenerating { loader.respond( with: .ok, body: randomData(), - when: [] + when: [], ) await #expect(throws: SimulatedURLRequestLoader.UnfulfillableRequestError(request: urlRequest)) { diff --git a/Tests/DevFoundationTests/Networking/Simulated URL Request Loader/SuccessResponseTemplateTests.swift b/Tests/DevFoundationTests/Networking/Simulated URL Request Loader/SuccessResponseTemplateTests.swift index faf9186..3d4898d 100644 --- a/Tests/DevFoundationTests/Networking/Simulated URL Request Loader/SuccessResponseTemplateTests.swift +++ b/Tests/DevFoundationTests/Networking/Simulated URL Request Loader/SuccessResponseTemplateTests.swift @@ -23,7 +23,7 @@ struct SuccessResponseTemplateTests: RandomValueGenerating { let template = SimulatedURLRequestLoader.SuccessResponseTemplate( statusCode: statusCode, headerItems: headerItems, - body: body + body: body, ) #expect(template.statusCode == statusCode) @@ -41,7 +41,7 @@ struct SuccessResponseTemplateTests: RandomValueGenerating { let template = SimulatedURLRequestLoader.SuccessResponseTemplate( statusCode: statusCode, headerItems: headerItems, - body: body + body: body, ) let requestComponents = try #require( @@ -57,7 +57,7 @@ struct SuccessResponseTemplateTests: RandomValueGenerating { let expectedHeaderFields = Dictionary( headerItems.map { ($0.field.rawValue, $0.value) }, - uniquingKeysWith: { $1 } + uniquingKeysWith: { $1 }, ) #expect(httpResponse.allHeaderFields as? [String: String] == expectedHeaderFields) } @@ -79,7 +79,7 @@ struct SuccessResponseTemplateTests: RandomValueGenerating { let template = SimulatedURLRequestLoader.SuccessResponseTemplate( statusCode: statusCode, headerItems: headerItems, - body: body + body: body, ) let requestComponents = try #require( diff --git a/Tests/DevFoundationTests/Networking/Web Service Client/JSONBodyWebServiceRequestTests.swift b/Tests/DevFoundationTests/Networking/Web Service Client/JSONBodyWebServiceRequestTests.swift index 1148eb2..51c958d 100644 --- a/Tests/DevFoundationTests/Networking/Web Service Client/JSONBodyWebServiceRequestTests.swift +++ b/Tests/DevFoundationTests/Networking/Web Service Client/JSONBodyWebServiceRequestTests.swift @@ -58,7 +58,7 @@ struct JSONBodyWebServiceRequestTests: RandomValueGenerating { let expectedError = randomError() let request = MockJSONBodyWebServiceRequest( jsonBody: AlwaysThrowingEncodable(error: expectedError), - jsonEncoder: JSONEncoder() + jsonEncoder: JSONEncoder(), ) #expect(throws: expectedError) { diff --git a/Tests/DevFoundationTests/Networking/Web Service Client/WebServiceClientTests.swift b/Tests/DevFoundationTests/Networking/Web Service Client/WebServiceClientTests.swift index 54b65f6..b467963 100644 --- a/Tests/DevFoundationTests/Networking/Web Service Client/WebServiceClientTests.swift +++ b/Tests/DevFoundationTests/Networking/Web Service Client/WebServiceClientTests.swift @@ -21,7 +21,7 @@ struct WebServiceClientTests: RandomValueGenerating { let client = WebServiceClient( httpClient: httpClient, - baseURLConfiguration: baseURLConfiguration + baseURLConfiguration: baseURLConfiguration, ) #expect(client.httpClient === httpClient) @@ -44,13 +44,13 @@ struct WebServiceClientTests: RandomValueGenerating { pathComponents: [], fragment: nil, queryItems: [], - httpBodyResult: .failure(expectedError) + httpBodyResult: .failure(expectedError), ) let httpClient = HTTPClient(urlRequestLoader: MockURLRequestLoader()) let client = WebServiceClient( httpClient: httpClient, - baseURLConfiguration: baseURLConfiguration + baseURLConfiguration: baseURLConfiguration, ) do { @@ -79,7 +79,7 @@ struct WebServiceClientTests: RandomValueGenerating { pathComponents: [], fragment: nil, queryItems: [], - httpBodyResult: .success(randomHTTPBody()) + httpBodyResult: .success(randomHTTPBody()), ) let expectedError = randomError() @@ -89,7 +89,7 @@ struct WebServiceClientTests: RandomValueGenerating { let httpClient = HTTPClient(urlRequestLoader: urlRequestLoader) let client = WebServiceClient( httpClient: httpClient, - baseURLConfiguration: baseURLConfiguration + baseURLConfiguration: baseURLConfiguration, ) await #expect(throws: expectedError) { @@ -115,7 +115,7 @@ struct WebServiceClientTests: RandomValueGenerating { pathComponents: [], fragment: nil, queryItems: [], - httpBodyResult: .success(randomHTTPBody()) + httpBodyResult: .success(randomHTTPBody()), ) let expectedError = randomError() request.mapResponseStub = ThrowingStub(defaultError: expectedError) @@ -127,7 +127,7 @@ struct WebServiceClientTests: RandomValueGenerating { let httpClient = HTTPClient(urlRequestLoader: urlRequestLoader) let client = WebServiceClient( httpClient: httpClient, - baseURLConfiguration: baseURLConfiguration + baseURLConfiguration: baseURLConfiguration, ) await #expect(throws: expectedError) { @@ -154,7 +154,7 @@ struct WebServiceClientTests: RandomValueGenerating { pathComponents: Array(count: randomInt(in: 1 ... 5)) { randomURLPathComponent() }, fragment: randomOptional(randomAlphanumericString()), queryItems: Array(count: randomInt(in: 1 ... 5)) { randomURLQueryItem() }, - httpBodyResult: .success(randomHTTPBody()) + httpBodyResult: .success(randomHTTPBody()), ) let expectedMappedResponse = randomBasicLatinString() request.mapResponseStub = ThrowingStub(defaultReturnValue: expectedMappedResponse) @@ -167,7 +167,7 @@ struct WebServiceClientTests: RandomValueGenerating { let httpClient = HTTPClient(urlRequestLoader: urlRequestLoader) let client = WebServiceClient( httpClient: httpClient, - baseURLConfiguration: baseURLConfiguration + baseURLConfiguration: baseURLConfiguration, ) let response = try await usesLoadUsingSyntax ? request.load(using: client) : client.load(request) diff --git a/Tests/DevFoundationTests/Networking/Web Service Client/WebServiceRequestTests.swift b/Tests/DevFoundationTests/Networking/Web Service Client/WebServiceRequestTests.swift index bbc88ac..8c7b6c3 100644 --- a/Tests/DevFoundationTests/Networking/Web Service Client/WebServiceRequestTests.swift +++ b/Tests/DevFoundationTests/Networking/Web Service Client/WebServiceRequestTests.swift @@ -48,7 +48,7 @@ struct WebServiceRequestTests: RandomValueGenerating { pathComponents: pathComponents, fragment: fragment, queryItems: queryItems, - httpBodyResult: .success(httpBody) + httpBodyResult: .success(httpBody), ) let baseURLConfiguration = MockBaseURLConfiguration() @@ -64,7 +64,7 @@ struct WebServiceRequestTests: RandomValueGenerating { var urlComponents = URLComponents( url: URL(string: pathComponents.map(\.rawValue).joined(separator: "/"), relativeTo: url)!, - resolvingAgainstBaseURL: true + resolvingAgainstBaseURL: true, )! urlComponents.fragment = fragment urlComponents.queryItems = queryItems @@ -88,7 +88,7 @@ struct WebServiceRequestTests: RandomValueGenerating { pathComponents: [], fragment: fragment, queryItems: [], - httpBodyResult: .success(httpBody) + httpBodyResult: .success(httpBody), ) let baseURLConfiguration = MockBaseURLConfiguration() @@ -117,7 +117,7 @@ struct WebServiceRequestTests: RandomValueGenerating { let queryItems = Array(count: randomInt(in: 1 ... 5)) { URLQueryItem( name: randomQueryString().addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed)!, - value: randomQueryString().addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed)! + value: randomQueryString().addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed)!, ) } let httpBody = randomHTTPBody() @@ -131,7 +131,7 @@ struct WebServiceRequestTests: RandomValueGenerating { fragment: fragment, queryItems: queryItems, automaticallyPercentEncodesQueryItems: false, - httpBodyResult: .success(httpBody) + httpBodyResult: .success(httpBody), ) let baseURLConfiguration = MockBaseURLConfiguration() @@ -168,7 +168,7 @@ struct WebServiceRequestTests: RandomValueGenerating { pathComponents: [], fragment: nil, queryItems: [], - httpBodyResult: .failure(expectedError) + httpBodyResult: .failure(expectedError), ) let baseURLConfiguration = MockBaseURLConfiguration() diff --git a/Tests/DevFoundationTests/Paging/RandomAccessPagerTests.swift b/Tests/DevFoundationTests/Paging/RandomAccessPagerTests.swift index e3d589a..94d9090 100644 --- a/Tests/DevFoundationTests/Paging/RandomAccessPagerTests.swift +++ b/Tests/DevFoundationTests/Paging/RandomAccessPagerTests.swift @@ -161,7 +161,7 @@ struct RandomAccessPagerTests: RandomValueGenerating { mockLoader.loadPageStub = ThrowingStub( defaultReturnValue: page1, - resultQueue: [.success(page2), .success(page0)] + resultQueue: [.success(page2), .success(page0)], ) let pager = RandomAccessPager(pageLoader: mockLoader) @@ -225,7 +225,7 @@ struct RandomAccessPagerTests: RandomValueGenerating { mockLoader.loadPageStub = ThrowingStub( defaultReturnValue: page2, - resultQueue: [.success(page1)] + resultQueue: [.success(page1)], ) // Add delay to allow both calls to get past cache check diff --git a/Tests/DevFoundationTests/Paging/SequentialPagerTests.swift b/Tests/DevFoundationTests/Paging/SequentialPagerTests.swift index 54f9c29..4e07a24 100644 --- a/Tests/DevFoundationTests/Paging/SequentialPagerTests.swift +++ b/Tests/DevFoundationTests/Paging/SequentialPagerTests.swift @@ -83,7 +83,7 @@ struct SequentialPagerTests: RandomValueGenerating { mockLoader.loadPageStub = ThrowingStub( defaultReturnValue: page2, - resultQueue: [.success(page1)] + resultQueue: [.success(page1)], ) let pager = SequentialPager(pageLoader: mockLoader) @@ -148,7 +148,7 @@ struct SequentialPagerTests: RandomValueGenerating { mockLoader.loadPageStub = ThrowingStub( defaultReturnValue: page2, - resultQueue: [.success(page1)] + resultQueue: [.success(page1)], ) // Add delay to allow both calls to get past cache check diff --git a/Tests/DevFoundationTests/Remote Localization/Bundle+RemoteContentTests.swift b/Tests/DevFoundationTests/Remote Localization/Bundle+RemoteContentTests.swift index e6fb9a7..d6eab17 100644 --- a/Tests/DevFoundationTests/Remote Localization/Bundle+RemoteContentTests.swift +++ b/Tests/DevFoundationTests/Remote Localization/Bundle+RemoteContentTests.swift @@ -23,7 +23,8 @@ struct Bundle_RemoteContentTests: RandomValueGenerating { } // exercise the test by creating the remote content bundle - let bundle = try #require(try Bundle.makeRemoteContentBundle(at: bundleURL, localizedStrings: localizedStrings)) + let bundle = try #require( + try Bundle.makeRemoteContentBundle(at: bundleURL, localizedStrings: localizedStrings)) // expect that the bundle was created at the correct URL with the correct structure #expect(bundle.bundleURL.standardizedFileURL == bundleURL.standardizedFileURL) diff --git a/Tests/DevFoundationTests/Remote Localization/RemoteLocalizedStringTests.swift b/Tests/DevFoundationTests/Remote Localization/RemoteLocalizedStringTests.swift index 31a5bcc..735edc7 100644 --- a/Tests/DevFoundationTests/Remote Localization/RemoteLocalizedStringTests.swift +++ b/Tests/DevFoundationTests/Remote Localization/RemoteLocalizedStringTests.swift @@ -46,7 +46,7 @@ struct LocalizationTests: RandomValueGenerating { String.LocalizationValue(localKey), key: localKey, bundle: localBundle, - remoteContentBundle: remoteBundle + remoteContentBundle: remoteBundle, ) #expect(result == localValue) diff --git a/Tests/DevFoundationTests/Testing Helpers/Date+IsApproximatelyEqual.swift b/Tests/DevFoundationTests/Testing Helpers/Date+IsApproximatelyEqual.swift index 34d3b40..50bb12e 100644 --- a/Tests/DevFoundationTests/Testing Helpers/Date+IsApproximatelyEqual.swift +++ b/Tests/DevFoundationTests/Testing Helpers/Date+IsApproximatelyEqual.swift @@ -12,7 +12,7 @@ extension Date { func isApproximatelyEqual(to date: Date, absoluteTolerance: TimeInterval) -> Bool { return timeIntervalSinceReferenceDate.isApproximatelyEqual( to: date.timeIntervalSinceReferenceDate, - absoluteTolerance: absoluteTolerance + absoluteTolerance: absoluteTolerance, ) } } diff --git a/Tests/DevFoundationTests/Testing Helpers/MockHTTPClientInterceptor.swift b/Tests/DevFoundationTests/Testing Helpers/MockHTTPClientInterceptor.swift index 8e4422f..9703f45 100644 --- a/Tests/DevFoundationTests/Testing Helpers/MockHTTPClientInterceptor.swift +++ b/Tests/DevFoundationTests/Testing Helpers/MockHTTPClientInterceptor.swift @@ -25,7 +25,7 @@ where RequestContext: Sendable { func intercept( request: URLRequest, context: RequestContext, - next: (URLRequest, RequestContext) async throws -> HTTPResponse + next: (URLRequest, RequestContext) async throws -> HTTPResponse, ) async throws -> HTTPResponse { try await interceptPrologue?() diff --git a/Tests/DevFoundationTests/Testing Helpers/MockLiveQueryResultsProducer.swift b/Tests/DevFoundationTests/Testing Helpers/MockLiveQueryResultsProducer.swift index 9fb5c76..1003db3 100644 --- a/Tests/DevFoundationTests/Testing Helpers/MockLiveQueryResultsProducer.swift +++ b/Tests/DevFoundationTests/Testing Helpers/MockLiveQueryResultsProducer.swift @@ -10,7 +10,6 @@ import Foundation @testable import DevFoundation - final class MockLiveQueryResultsProducer: LiveQueryResultsProducer where Results: Sendable { nonisolated(unsafe) var schedulingStrategyStub: Stub! nonisolated(unsafe) var canonicalQueryFragmentStub: Stub! diff --git a/Tests/DevFoundationTests/Testing Helpers/MockRetryPolicy.swift b/Tests/DevFoundationTests/Testing Helpers/MockRetryPolicy.swift index d655aea..1fe075c 100644 --- a/Tests/DevFoundationTests/Testing Helpers/MockRetryPolicy.swift +++ b/Tests/DevFoundationTests/Testing Helpers/MockRetryPolicy.swift @@ -25,14 +25,14 @@ final class MockRetryPolicy: HashableByID, RetryPolicy { forInput input: Input, output: Output, attemptCount: Int, - previousDelay: Duration? + previousDelay: Duration?, ) -> Duration? { retryDelayStub( .init( input: input, output: output, attemptCount: attemptCount, - previousDelay: previousDelay + previousDelay: previousDelay, ) ) } diff --git a/Tests/DevFoundationTests/Testing Helpers/MockWebServiceRequest.swift b/Tests/DevFoundationTests/Testing Helpers/MockWebServiceRequest.swift index c56159f..bb46dd7 100644 --- a/Tests/DevFoundationTests/Testing Helpers/MockWebServiceRequest.swift +++ b/Tests/DevFoundationTests/Testing Helpers/MockWebServiceRequest.swift @@ -34,7 +34,7 @@ final class MockWebServiceRequest: WebServiceRequest { fragment: String?, queryItems: [URLQueryItem], automaticallyPercentEncodesQueryItems: Bool = true, - httpBodyResult: Result + httpBodyResult: Result, ) { self.httpMethod = httpMethod self.headerItems = headerItems diff --git a/Tests/DevFoundationTests/Testing Helpers/RandomValueGenerating+DevFoundation.swift b/Tests/DevFoundationTests/Testing Helpers/RandomValueGenerating+DevFoundation.swift index 4381f95..7fe7d99 100644 --- a/Tests/DevFoundationTests/Testing Helpers/RandomValueGenerating+DevFoundation.swift +++ b/Tests/DevFoundationTests/Testing Helpers/RandomValueGenerating+DevFoundation.swift @@ -13,7 +13,7 @@ extension RandomValueGenerating { mutating func randomDuration() -> Duration { return Duration( secondsComponent: random(Int64.self, in: 0 ... 10_000_000), - attosecondsComponent: random(Int64.self, in: 0 ... 999_999_999_999_999_999) + attosecondsComponent: random(Int64.self, in: 0 ... 999_999_999_999_999_999), ) } @@ -35,7 +35,7 @@ extension RandomValueGenerating { mutating func randomHTTPHeaderItem() -> HTTPHeaderItem { return HTTPHeaderItem( field: randomHTTPHeaderField(), - value: randomAlphanumericString() + value: randomAlphanumericString(), ) } @@ -62,7 +62,7 @@ extension RandomValueGenerating { httpVersion: "1.1", headerFields: Dictionary(count: randomInt(in: 3 ..< 10)) { (randomAlphanumericString(), randomAlphanumericString()) - } + }, )! } diff --git a/Tests/DevFoundationTests/Utility Types/ExpiringValueTests.swift b/Tests/DevFoundationTests/Utility Types/ExpiringValueTests.swift index 6ef0529..cd5a5cd 100644 --- a/Tests/DevFoundationTests/Utility Types/ExpiringValueTests.swift +++ b/Tests/DevFoundationTests/Utility Types/ExpiringValueTests.swift @@ -60,7 +60,7 @@ struct ExpiringValueTests: RandomValueGenerating { mutating func expireMarksValueAsExpired() { var expiringValue = ExpiringValue( randomInt(in: .min ... .max), - lifetimeRange: .distantPast ... .distantFuture + lifetimeRange: .distantPast ... .distantFuture, ) expiringValue.expire() @@ -78,7 +78,7 @@ struct ExpiringValueTests: RandomValueGenerating { let expiringValue = ExpiringValue( random(UInt.self, in: 0 ... .max), - lifetimeRange: start ... end + lifetimeRange: start ... end, ) #expect(!expiringValue.isExpired) diff --git a/Tests/DevFoundationTests/Utility Types/GibberishGeneratorTests.swift b/Tests/DevFoundationTests/Utility Types/GibberishGeneratorTests.swift index 49cf2a7..998a3ba 100644 --- a/Tests/DevFoundationTests/Utility Types/GibberishGeneratorTests.swift +++ b/Tests/DevFoundationTests/Utility Types/GibberishGeneratorTests.swift @@ -26,7 +26,7 @@ struct GibberishGeneratorTests: RandomValueGenerating { sentenceSeparator: ".", sentenceTemplates: ["_"], templateWordToken: "_", - words: ["a"] + words: ["a"], ) } @@ -38,7 +38,7 @@ struct GibberishGeneratorTests: RandomValueGenerating { sentenceSeparator: ".", sentenceTemplates: ["_"], templateWordToken: "_", - words: ["b"] + words: ["b"], ) } } @@ -54,7 +54,7 @@ struct GibberishGeneratorTests: RandomValueGenerating { sentenceSeparator: ".", sentenceTemplates: [], templateWordToken: "_", - words: ["c"] + words: ["c"], ) } } @@ -70,7 +70,7 @@ struct GibberishGeneratorTests: RandomValueGenerating { sentenceSeparator: ".", sentenceTemplates: ["_"], templateWordToken: "", - words: ["c"] + words: ["c"], ) } } @@ -86,7 +86,7 @@ struct GibberishGeneratorTests: RandomValueGenerating { sentenceSeparator: ".", sentenceTemplates: ["_"], templateWordToken: "_", - words: [] + words: [], ) } } @@ -145,7 +145,7 @@ struct GibberishGeneratorTests: RandomValueGenerating { var sentenceCount = 0 paragraph.enumerateSubstrings( in: paragraph.startIndex ..< paragraph.endIndex, - options: .bySentences + options: .bySentences, ) { (sentence, _, _, _) in guard let sentence else { Issue.record("sentence is nil") @@ -179,7 +179,7 @@ struct GibberishGeneratorTests: RandomValueGenerating { var sentenceCount = 0 paragraph.enumerateSubstrings( in: paragraph.startIndex ..< paragraph.endIndex, - options: .bySentences + options: .bySentences, ) { (sentence, _, _, _) in guard sentence != nil else { Issue.record("sentence is nil") @@ -204,7 +204,7 @@ struct GibberishGeneratorTests: RandomValueGenerating { var sentenceCount = 0 paragraph1.enumerateSubstrings( in: paragraph1.startIndex ..< paragraph1.endIndex, - options: .bySentences + options: .bySentences, ) { (sentence, _, _, _) in guard let sentence else { Issue.record("sentence is nil") @@ -237,14 +237,14 @@ struct GibberishGeneratorTests: RandomValueGenerating { let paragraph1 = generator.generateParagraph(using: &localRNG, sentenceCount: expectedSentenceCount) let paragraph2 = generator.generateParagraph( using: &randomNumberGenerator, - sentenceCount: expectedSentenceCount + sentenceCount: expectedSentenceCount, ) #expect(paragraph1 == paragraph2) var sentenceCount = 0 paragraph1.enumerateSubstrings( in: paragraph1.startIndex ..< paragraph1.endIndex, - options: .bySentences + options: .bySentences, ) { (sentence, _, _, _) in guard sentence != nil else { Issue.record("sentence is nil") diff --git a/Tests/DevFoundationTests/Utility Types/HashableByIDTests.swift b/Tests/DevFoundationTests/Utility Types/HashableByIDTests.swift index d8d4236..19781fc 100644 --- a/Tests/DevFoundationTests/Utility Types/HashableByIDTests.swift +++ b/Tests/DevFoundationTests/Utility Types/HashableByIDTests.swift @@ -22,21 +22,21 @@ struct HashableByIDTests: RandomValueGenerating { id: equalID, irrelevantBool: randomBool(), irrelevantInt: randomInt(in: .min ... .max), - irrelevantString: randomBasicLatinString() + irrelevantString: randomBasicLatinString(), ) let equal2 = MockHashableByID( id: equalID, irrelevantBool: randomBool(), irrelevantInt: randomInt(in: .min ... .max), - irrelevantString: randomBasicLatinString() + irrelevantString: randomBasicLatinString(), ) let unequal = MockHashableByID( id: equalID + 1, irrelevantBool: randomBool(), irrelevantInt: randomInt(in: .min ... .max), - irrelevantString: randomBasicLatinString() + irrelevantString: randomBasicLatinString(), ) #expect(equal1 == equal2) diff --git a/Tests/DevFoundationTests/Utility Types/IdentifiableBySelfTests.swift b/Tests/DevFoundationTests/Utility Types/IdentifiableBySelfTests.swift index 80d75f0..eb0578f 100644 --- a/Tests/DevFoundationTests/Utility Types/IdentifiableBySelfTests.swift +++ b/Tests/DevFoundationTests/Utility Types/IdentifiableBySelfTests.swift @@ -20,7 +20,7 @@ struct IdentifiableBySelfTests: RandomValueGenerating { bool: randomBool(), int: randomInt(in: .min ... .max), float64: randomFloat64(in: -10_000 ... 10_000), - string: randomAlphanumericString() + string: randomAlphanumericString(), ) #expect(value.id == value) diff --git a/Tests/DevFoundationTests/Utility Types/JSONValueTests.swift b/Tests/DevFoundationTests/Utility Types/JSONValueTests.swift index 1082808..cb0ae11 100644 --- a/Tests/DevFoundationTests/Utility Types/JSONValueTests.swift +++ b/Tests/DevFoundationTests/Utility Types/JSONValueTests.swift @@ -517,7 +517,7 @@ struct JSONValueTests: RandomValueGenerating { .string("two"), .number(.floatingPoint(3.0)), .null, - ], + ] ), .boolean(true), .number(.integer(-1)), @@ -532,7 +532,7 @@ struct JSONValueTests: RandomValueGenerating { "4": .null, "5": [.boolean(false), .number(.integer(1)), .string("two"), .number(.floatingPoint(3.0)), .null], "6": ["key": .string("value")], - ], + ] ), .string("string"), ] diff --git a/Tests/DevFoundationTests/Utility Types/RetryPolicyTests.swift b/Tests/DevFoundationTests/Utility Types/RetryPolicyTests.swift index 6d5f7d1..1475697 100644 --- a/Tests/DevFoundationTests/Utility Types/RetryPolicyTests.swift +++ b/Tests/DevFoundationTests/Utility Types/RetryPolicyTests.swift @@ -24,7 +24,7 @@ struct RetryPolicyTests: RandomValueGenerating { let policy = PredefinedDelaySequenceRetryPolicy( delays: delays, maxRetries: maxRetries, - retryPredicate: { _, _ in true } + retryPredicate: { _, _ in true }, ) #expect(policy.delays == delays) @@ -40,7 +40,7 @@ struct RetryPolicyTests: RandomValueGenerating { let policy = PredefinedDelaySequenceRetryPolicy( delays: delays, - retryPredicate: { _, _ in true } + retryPredicate: { _, _ in true }, ) #expect(policy.delays == delays) @@ -53,14 +53,14 @@ struct RetryPolicyTests: RandomValueGenerating { let policy = PredefinedDelaySequenceRetryPolicy( delays: [], maxRetries: 1, - retryPredicate: { _, _ in true } + retryPredicate: { _, _ in true }, ) let delay = policy.retryDelay( forInput: randomAlphanumericString(), output: randomAlphanumericString(), attemptCount: 1, - previousDelay: nil + previousDelay: nil, ) #expect(delay == .zero) @@ -73,14 +73,14 @@ struct RetryPolicyTests: RandomValueGenerating { let policy = PredefinedDelaySequenceRetryPolicy( delays: [singleDelay], maxRetries: 2, - retryPredicate: { _, _ in true } + retryPredicate: { _, _ in true }, ) let delay = policy.retryDelay( forInput: randomAlphanumericString(), output: randomAlphanumericString(), attemptCount: 1, - previousDelay: nil + previousDelay: nil, ) #expect(delay == singleDelay) @@ -93,7 +93,7 @@ struct RetryPolicyTests: RandomValueGenerating { let policy = PredefinedDelaySequenceRetryPolicy( delays: delays, maxRetries: 5, - retryPredicate: { _, _ in true } + retryPredicate: { _, _ in true }, ) for (i, expected) in delays.enumerated() { @@ -101,7 +101,7 @@ struct RetryPolicyTests: RandomValueGenerating { forInput: randomAlphanumericString(), output: randomAlphanumericString(), attemptCount: i + 1, - previousDelay: i == 0 ? nil : delays[i - 1] + previousDelay: i == 0 ? nil : delays[i - 1], ) #expect(actual == expected) } @@ -112,14 +112,14 @@ struct RetryPolicyTests: RandomValueGenerating { mutating func testPredefinedDelaySequenceRetryPredicateFalse() { let policy = PredefinedDelaySequenceRetryPolicy( delays: [Duration.seconds(1)], - retryPredicate: { _, _ in false } + retryPredicate: { _, _ in false }, ) let delay = policy.retryDelay( forInput: randomAlphanumericString(), output: randomAlphanumericString(), attemptCount: 1, - previousDelay: nil + previousDelay: nil, ) #expect(delay == nil) @@ -130,14 +130,14 @@ struct RetryPolicyTests: RandomValueGenerating { mutating func testPredefinedDelaySequenceMaxAttemptsExceeded() { let policy = PredefinedDelaySequenceRetryPolicy( delays: [Duration.seconds(1)], - retryPredicate: { _, _ in true } + retryPredicate: { _, _ in true }, ) let delay = policy.retryDelay( forInput: randomAlphanumericString(), output: randomAlphanumericString(), attemptCount: 2, - previousDelay: nil + previousDelay: nil, ) #expect(delay == nil) @@ -175,7 +175,7 @@ struct RetryPolicyTests: RandomValueGenerating { forInput: input, output: output, attemptCount: attemptCount, - previousDelay: previousDelay + previousDelay: previousDelay, ) #expect(delay == expectedDelay) @@ -215,7 +215,7 @@ struct RetryPolicyTests: RandomValueGenerating { forInput: input, output: output, attemptCount: attemptCount, - previousDelay: previousDelay + previousDelay: previousDelay, ) #expect(delay == nil) diff --git a/Tests/DevFoundationTests/Utility Types/TopLevelCodingTests.swift b/Tests/DevFoundationTests/Utility Types/TopLevelCodingTests.swift index bc356d7..dd8d749 100644 --- a/Tests/DevFoundationTests/Utility Types/TopLevelCodingTests.swift +++ b/Tests/DevFoundationTests/Utility Types/TopLevelCodingTests.swift @@ -33,7 +33,7 @@ struct TopLevelCodingTests: RandomValueGenerating { array: [], bool: randomBool(), int: randomInt(in: .min ... .max), - string: expectedString + string: expectedString, ) let encodedData = try PropertyListEncoder().encode(mockCodable) @@ -41,7 +41,7 @@ struct TopLevelCodingTests: RandomValueGenerating { let actualString = try decoder.decode( String.self, from: encodedData, - topLevelKey: MockCodable.CodingKeys.string + topLevelKey: MockCodable.CodingKeys.string, ) #expect(actualString == expectedString) diff --git a/Tests/dfobTests/ObfuscateCommandTests.swift b/Tests/dfobTests/ObfuscateCommandTests.swift index acde930..6c687b8 100644 --- a/Tests/dfobTests/ObfuscateCommandTests.swift +++ b/Tests/dfobTests/ObfuscateCommandTests.swift @@ -86,7 +86,7 @@ struct ObfuscateCommandTests: RandomValueGenerating { let expectedObfuscatedData = try message.obfuscated( withKey: expectedKey, keySizeType: UInt8.self, - messageSizeType: UInt32.self + messageSizeType: UInt32.self, ) #expect(obfuscatedData == expectedObfuscatedData)