diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ec56e889a..6320bce3c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -23,7 +23,7 @@ jobs: - name: Use multiple cores run: defaults write com.apple.dt.XCBuild EnableSwiftBuildSystemIntegration 1 - name: Build-Test - run: set -o pipefail && env NSUnbufferedIO=YES xcodebuild -workspace Parse.xcworkspace -scheme ParseSwift\ \(iOS\) -destination platform\=iOS\ Simulator,name\=iPhone\ 12\ Pro\ Max -derivedDataPath DerivedData -test-iterations 10 -retry-tests-on-failure clean test | xcpretty + run: set -o pipefail && env NSUnbufferedIO=YES xcodebuild -workspace Parse.xcworkspace -scheme ParseSwift\ \(iOS\) -destination platform\=iOS\ Simulator,name\=iPhone\ 12\ Pro\ Max -derivedDataPath DerivedData clean test | xcpretty env: DEVELOPER_DIR: ${{ env.CI_XCODE_LATEST }} - name: Prepare codecov @@ -57,7 +57,7 @@ jobs: - name: Use multiple cores run: defaults write com.apple.dt.XCBuild EnableSwiftBuildSystemIntegration 1 - name: Build-Test - run: set -o pipefail && env NSUnbufferedIO=YES xcodebuild -workspace Parse.xcworkspace -scheme ParseSwift\ \(macOS\) -destination platform\=macOS -derivedDataPath DerivedData -test-iterations 10 -retry-tests-on-failure clean test | xcpretty + run: set -o pipefail && env NSUnbufferedIO=YES xcodebuild -workspace Parse.xcworkspace -scheme ParseSwift\ \(macOS\) -destination platform\=macOS -derivedDataPath DerivedData clean test | xcpretty env: DEVELOPER_DIR: ${{ env.CI_XCODE_LATEST }} - name: Prepare codecov @@ -84,8 +84,8 @@ jobs: - uses: actions/checkout@v3 - name: Use multiple cores run: defaults write com.apple.dt.XCBuild EnableSwiftBuildSystemIntegration 1 - - name: Build - run: set -o pipefail && env NSUnbufferedIO=YES xcodebuild -workspace Parse.xcworkspace -scheme ParseSwift\ \(tvOS\) -destination platform\=tvOS\ Simulator,name\=Apple\ TV -derivedDataPath DerivedData -test-iterations 10 -retry-tests-on-failure clean test | xcpretty + - name: Build-Test + run: set -o pipefail && env NSUnbufferedIO=YES xcodebuild -workspace Parse.xcworkspace -scheme ParseSwift\ \(tvOS\) -destination platform\=tvOS\ Simulator,name\=Apple\ TV -derivedDataPath DerivedData clean test | xcpretty env: DEVELOPER_DIR: ${{ env.CI_XCODE_LATEST }} - name: Prepare codecov @@ -136,7 +136,7 @@ jobs: security set-keychain-settings -lut 7200 temporary - name: Use multiple cores run: defaults write com.apple.dt.XCBuild EnableSwiftBuildSystemIntegration 1 - - name: Build and Test + - name: Build-Test run: swift test --enable-code-coverage -v env: DEVELOPER_DIR: ${{ env.CI_XCODE_LATEST }} @@ -157,14 +157,14 @@ jobs: env: DEVELOPER_DIR: ${{ env.CI_XCODE_LATEST }} - xcode-test-ios-5_4: + xcode-test-tvos-5_4: timeout-minutes: 15 needs: xcode-build-watchos runs-on: macos-11 steps: - uses: actions/checkout@v3 - name: Build-Test - run: set -o pipefail && env NSUnbufferedIO=YES xcodebuild -workspace Parse.xcworkspace -scheme ParseSwift\ \(iOS\) -destination platform\=iOS\ Simulator,name\=iPhone\ 11 -derivedDataPath DerivedData clean test | xcpretty + run: set -o pipefail && env NSUnbufferedIO=YES xcodebuild -workspace Parse.xcworkspace -scheme ParseSwift\ \(tvOS\) -destination platform\=tvOS\ Simulator,name\=Apple\ TV -derivedDataPath DerivedData clean test | xcpretty env: DEVELOPER_DIR: ${{ env.CI_XCODE_OLDEST }} - name: Prepare codecov diff --git a/.swiftlint.yml b/.swiftlint.yml index 85979751d..a0078631b 100644 --- a/.swiftlint.yml +++ b/.swiftlint.yml @@ -1,13 +1,5 @@ disabled_rules: - - large_tuple - - unused_optional_binding - - type_name - file_length - - cyclomatic_complexity - - function_body_length - - type_body_length - - inclusive_language - - comment_spacing - identifier_name excluded: # paths to ignore during linting. Takes precedence over `included`. - Tests/ParseSwiftTests/ParseEncoderTests diff --git a/ParseSwift.playground/Pages/11 - LiveQuery.xcplaygroundpage/Contents.swift b/ParseSwift.playground/Pages/11 - LiveQuery.xcplaygroundpage/Contents.swift index 1884da1f1..b99d2cf9b 100644 --- a/ParseSwift.playground/Pages/11 - LiveQuery.xcplaygroundpage/Contents.swift +++ b/ParseSwift.playground/Pages/11 - LiveQuery.xcplaygroundpage/Contents.swift @@ -191,7 +191,7 @@ subscription2.handleUnsubscribe { query in ParseLiveQuery.client?.close() //: To close all LiveQuery connections use: -//ParseLiveQuery.client?.closeAll() +// ParseLiveQuery.client?.closeAll() //: Ping the LiveQuery server. This should produce an error //: because LiveQuery is disconnected. diff --git a/ParseSwift.playground/Pages/7 - GeoPoint.xcplaygroundpage/Contents.swift b/ParseSwift.playground/Pages/7 - GeoPoint.xcplaygroundpage/Contents.swift index 7b72f640e..07f965023 100644 --- a/ParseSwift.playground/Pages/7 - GeoPoint.xcplaygroundpage/Contents.swift +++ b/ParseSwift.playground/Pages/7 - GeoPoint.xcplaygroundpage/Contents.swift @@ -322,8 +322,8 @@ query2.find { result in /*: Explain the previous query. Read the documentation note on `explain` queries and use a type-erased wrapper such as AnyCodable. */ -//let explain: AnyDecodable = try query8.firstExplain() -//print(explain) +// let explain: AnyDecodable = try query8.firstExplain() +// print(explain) PlaygroundPage.current.finishExecution() //: [Next](@next) diff --git a/ParseSwift.xcodeproj/project.pbxproj b/ParseSwift.xcodeproj/project.pbxproj index ca4fc1703..b6ef08025 100644 --- a/ParseSwift.xcodeproj/project.pbxproj +++ b/ParseSwift.xcodeproj/project.pbxproj @@ -2442,7 +2442,6 @@ 912C9BD424D3011F009947C3 /* Sources */, 912C9BD524D3011F009947C3 /* Frameworks */, 912C9BD624D3011F009947C3 /* Resources */, - 918CED61268A23A700CFDC83 /* SwiftLint */, ); buildRules = ( ); @@ -2637,25 +2636,6 @@ shellPath = /bin/sh; shellScript = "if test -d \"/opt/homebrew/bin/\"; then\n PATH=\"/opt/homebrew/bin/:${PATH}\"\nfi\n\nexport PATH\n\nif which swiftlint >/dev/null; then\n swiftlint --fix && swiftlint --strict\nelse\n echo \"warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint\"\nfi\n"; }; - 918CED61268A23A700CFDC83 /* SwiftLint */ = { - isa = PBXShellScriptBuildPhase; - alwaysOutOfDate = 1; - buildActionMask = 2147483647; - files = ( - ); - inputFileListPaths = ( - ); - inputPaths = ( - ); - name = SwiftLint; - outputFileListPaths = ( - ); - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "if which swiftlint >/dev/null; then\n swiftlint --strict\nelse\n echo \"warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint\"\nfi\n"; - }; 918CED62268A23E600CFDC83 /* SwiftLint */ = { isa = PBXShellScriptBuildPhase; alwaysOutOfDate = 1; diff --git a/Sources/ParseSwift/API/API+Command.swift b/Sources/ParseSwift/API/API+Command.swift index 0d70a3709..165b0ca5b 100644 --- a/Sources/ParseSwift/API/API+Command.swift +++ b/Sources/ParseSwift/API/API+Command.swift @@ -13,6 +13,7 @@ import FoundationNetworking internal extension API { // MARK: API.Command + // swiftlint:disable:next type_body_length struct Command: Encodable where T: ParseEncodable { typealias ReturnType = U // swiftlint:disable:this nesting let method: API.Method @@ -249,7 +250,7 @@ internal extension API { } } } else if let otherURL = self.otherURL { - //Non-parse servers do not receive any parse dedicated request info + // Non-parse servers do not receive any parse dedicated request info var request = URLRequest(url: otherURL) request.cachePolicy = requestCachePolicy(options: options) URLSession.parse.downloadTask(with: request, mapper: mapper) { result in diff --git a/Sources/ParseSwift/API/API+NonParseBodyCommand.swift b/Sources/ParseSwift/API/API+NonParseBodyCommand.swift index c2596cbef..4f59c5e76 100644 --- a/Sources/ParseSwift/API/API+NonParseBodyCommand.swift +++ b/Sources/ParseSwift/API/API+NonParseBodyCommand.swift @@ -151,6 +151,7 @@ internal extension API.NonParseBodyCommand { internal extension API.NonParseBodyCommand { // MARK: Batch - Child Objects + // swiftlint:disable:next function_body_length static func batch(objects: [ParseEncodable], transaction: Bool, objectsSavedBeforeThisOne: [String: PointerType]?, diff --git a/Sources/ParseSwift/Coding/AnyDecodable.swift b/Sources/ParseSwift/Coding/AnyDecodable.swift index e7bb1f77e..adf872734 100755 --- a/Sources/ParseSwift/Coding/AnyDecodable.swift +++ b/Sources/ParseSwift/Coding/AnyDecodable.swift @@ -35,7 +35,7 @@ struct AnyDecodable: Decodable { } } -protocol _AnyDecodable { +protocol _AnyDecodable { // swiftlint:disable:this type_name var value: Any { get } init(_ value: T?) } @@ -74,6 +74,7 @@ extension _AnyDecodable { } extension AnyDecodable: Equatable { + // swiftlint:disable:next cyclomatic_complexity static func == (lhs: AnyDecodable, rhs: AnyDecodable) -> Bool { switch (lhs.value, rhs.value) { #if canImport(Foundation) diff --git a/Sources/ParseSwift/Coding/AnyEncodable.swift b/Sources/ParseSwift/Coding/AnyEncodable.swift index f7738bee4..f5bfe3549 100755 --- a/Sources/ParseSwift/Coding/AnyEncodable.swift +++ b/Sources/ParseSwift/Coding/AnyEncodable.swift @@ -38,7 +38,7 @@ struct AnyEncodable: Encodable { } @usableFromInline -protocol _AnyEncodable { +protocol _AnyEncodable { // swiftlint:disable:this type_name var value: Any { get } init(_ value: T?) @@ -110,6 +110,7 @@ extension _AnyEncodable { } #if canImport(Foundation) + // swiftlint:disable:next cyclomatic_complexity private func encode(nsnumber: NSNumber, into container: inout SingleValueEncodingContainer) throws { switch Character(Unicode.Scalar(UInt8(nsnumber.objCType.pointee))) { case "c", "C": diff --git a/Sources/ParseSwift/Coding/ParseEncoder.swift b/Sources/ParseSwift/Coding/ParseEncoder.swift index 317fd17cf..e86547557 100644 --- a/Sources/ParseSwift/Coding/ParseEncoder.swift +++ b/Sources/ParseSwift/Coding/ParseEncoder.swift @@ -6,7 +6,7 @@ // Copyright © 2020 Parse. All rights reserved. // -//===----------------------------------------------------------------------===// +// ===----------------------------------------------------------------------===// // // This source file is part of the Swift.org open source project // @@ -16,10 +16,12 @@ // See https://swift.org/LICENSE.txt for license information // See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // -//===----------------------------------------------------------------------===// +// ===----------------------------------------------------------------------===// import Foundation +// swiftlint:disable type_name + /// A marker protocol used to determine whether a value is a `String`-keyed `Dictionary` /// containing `Encodable` values (in which case it should be exempt from key conversion strategies). /// @@ -1117,9 +1119,9 @@ internal struct _ParseEncodingStorage { } } -//===----------------------------------------------------------------------===// +// ===----------------------------------------------------------------------===// // Error Utilities -//===----------------------------------------------------------------------===// +// ===----------------------------------------------------------------------===// extension EncodingError { /// Returns a `.invalidValue` error describing the given invalid floating-point value. @@ -1143,9 +1145,9 @@ extension EncodingError { } } -//===----------------------------------------------------------------------===// +// ===----------------------------------------------------------------------===// // Shared Key Types -//===----------------------------------------------------------------------===// +// ===----------------------------------------------------------------------===// private struct _JSONKey : CodingKey { public var stringValue: String @@ -1174,9 +1176,9 @@ private struct _JSONKey : CodingKey { static let `super` = _JSONKey(stringValue: "super")! } -//===----------------------------------------------------------------------===// +// ===----------------------------------------------------------------------===// // Shared ISO8601 Date Formatter -//===----------------------------------------------------------------------===// +// ===----------------------------------------------------------------------===// // swiftlint:disable:next line_length // NOTE: This value is implicitly lazy and _must_ be lazy. We're compiled against the latest SDK (w/ ISO8601DateFormatter), but linked against whichever Foundation the user has. ISO8601DateFormatter might not exist, so we better not hit this code path on an older OS. @available(macOS 10.12, iOS 10.0, watchOS 3.0, tvOS 10.0, *) diff --git a/Sources/ParseSwift/Extensions/URLSession.swift b/Sources/ParseSwift/Extensions/URLSession.swift index 8c0a54b74..35f2adf44 100644 --- a/Sources/ParseSwift/Extensions/URLSession.swift +++ b/Sources/ParseSwift/Extensions/URLSession.swift @@ -60,6 +60,7 @@ internal extension URLSession { return Int.random(in: 0 ..< Int(truncating: min)) } + // swiftlint:disable:next function_body_length cyclomatic_complexity func makeResult(request: URLRequest, responseData: Data?, urlResponse: URLResponse?, @@ -217,7 +218,7 @@ internal extension URLSession { } internal extension URLSession { - func uploadTask( // swiftlint:disable:this function_parameter_count + func uploadTask( // swiftlint:disable:this function_body_length function_parameter_count notificationQueue: DispatchQueue, with request: URLRequest, from data: Data?, diff --git a/Sources/ParseSwift/LiveQuery/ParseLiveQuery.swift b/Sources/ParseSwift/LiveQuery/ParseLiveQuery.swift index 300c3401e..930556670 100644 --- a/Sources/ParseSwift/LiveQuery/ParseLiveQuery.swift +++ b/Sources/ParseSwift/LiveQuery/ParseLiveQuery.swift @@ -51,7 +51,7 @@ public final class ParseLiveQuery: NSObject { let synchronizationQueue: DispatchQueue let notificationQueue: DispatchQueue - //Task + // Task var task: URLSessionWebSocketTask! { willSet { if newValue == nil && isSocketEstablished { @@ -108,7 +108,7 @@ Not attempting to open ParseLiveQuery socket anymore public weak var receiveDelegate: ParseLiveQueryDelegate? /// True if the connection to the url is up and available. False otherwise. - public internal(set) var isSocketEstablished = false { //URLSession has an established socket + public internal(set) var isSocketEstablished = false { // URLSession has an established socket willSet { if !newValue { isConnected = newValue @@ -125,7 +125,7 @@ Not attempting to open ParseLiveQuery socket anymore if let task = self.task { attempts = 1 - //Resubscribe to all subscriptions by moving them in front of pending + // Resubscribe to all subscriptions by moving them in front of pending var tempPendingSubscriptions = [(RequestId, SubscriptionRecord)]() self.subscriptions.forEach { (key, value) -> Void in tempPendingSubscriptions.append((key, value)) @@ -134,7 +134,7 @@ Not attempting to open ParseLiveQuery socket anymore tempPendingSubscriptions.append(contentsOf: pendingSubscriptions) pendingSubscriptions = tempPendingSubscriptions - //Send all pending messages in order + // Send all pending messages in order self.pendingSubscriptions.forEach { let messageToSend = $0 URLSession.liveQuery.send(messageToSend.1.messageData, task: task) { _ in } @@ -161,7 +161,7 @@ Not attempting to open ParseLiveQuery socket anymore } } - //Subscription + // Subscription let requestIdGenerator: () -> RequestId var subscriptions = [RequestId: SubscriptionRecord]() var pendingSubscriptions = [(RequestId, SubscriptionRecord)]() // Behave as FIFO to maintain sending order @@ -348,6 +348,7 @@ extension ParseLiveQuery: LiveQuerySocketDelegate { } } + // swiftlint:disable:next function_body_length cyclomatic_complexity func received(_ data: Data) { synchronizationQueue.sync { if let redirect = try? ParseCoding.jsonDecoder().decode(RedirectResponse.self, from: data) { @@ -355,21 +356,21 @@ extension ParseLiveQuery: LiveQuerySocketDelegate { self.url = redirect.url if self.isConnected { self.close(useDedicatedQueue: true) - //Try to reconnect + // Try to reconnect self.resumeTask { _ in } } } return } - //Check if this is an error response + // Check if this is an error response if let error = try? ParseCoding.jsonDecoder().decode(ErrorResponse.self, from: data) { if !error.reconnect { - //Treat this as a user disconnect because the server does not want to hear from us anymore + // Treat this as a user disconnect because the server does not want to hear from us anymore self.close() } guard let parseError = try? ParseCoding.jsonDecoder().decode(ParseError.self, from: data) else { - //Turn LiveQuery error into ParseError + // Turn LiveQuery error into ParseError let parseError = ParseError(code: .otherCause, // swiftlint:disable:next line_length message: "ParseLiveQuery Error: code: \(error.code), message: \(error.message)") @@ -383,10 +384,10 @@ extension ParseLiveQuery: LiveQuerySocketDelegate { } return } else if !self.isConnected { - //Check if this is a connected response + // Check if this is a connected response guard let response = try? ParseCoding.jsonDecoder().decode(ConnectionResponse.self, from: data), response.op == .connected else { - //If not connected, should not receive anything other than a connection response + // If not connected, should not receive anything other than a connection response guard let outOfOrderMessage = try? ParseCoding .jsonDecoder() .decode(AnyCodable.self, from: data) else { diff --git a/Sources/ParseSwift/Objects/ParseInstallation+async.swift b/Sources/ParseSwift/Objects/ParseInstallation+async.swift index 3da72bec0..e8d530263 100644 --- a/Sources/ParseSwift/Objects/ParseInstallation+async.swift +++ b/Sources/ParseSwift/Objects/ParseInstallation+async.swift @@ -366,6 +366,7 @@ internal extension ParseInstallation { // MARK: Batch Support internal extension Sequence where Element: ParseInstallation { + // swiftlint:disable:next function_body_length func batchCommand(method: Method, batchLimit limit: Int?, transaction: Bool, diff --git a/Sources/ParseSwift/Objects/ParseInstallation.swift b/Sources/ParseSwift/Objects/ParseInstallation.swift index 95142727e..92e1481fa 100644 --- a/Sources/ParseSwift/Objects/ParseInstallation.swift +++ b/Sources/ParseSwift/Objects/ParseInstallation.swift @@ -95,6 +95,7 @@ public extension ParseInstallation { "_Installation" } + // swiftlint:disable:next cyclomatic_complexity function_body_length func mergeParse(with object: Self) throws -> Self { guard hasSameObjectId(as: object) else { throw ParseError(code: .otherCause, @@ -1193,7 +1194,7 @@ public extension Sequence where Element: ParseInstallation { - note: The default cache policy for this method is `.reloadIgnoringLocalCacheData`. If a developer desires a different policy, it should be inserted in `options`. */ - func saveAll( // swiftlint:disable:this function_body_length cyclomatic_complexity + func saveAll( batchLimit limit: Int? = nil, transaction: Bool = configuration.isUsingTransactions, ignoringCustomObjectIdConfig: Bool = false, @@ -1251,7 +1252,7 @@ public extension Sequence where Element: ParseInstallation { - note: The default cache policy for this method is `.reloadIgnoringLocalCacheData`. If a developer desires a different policy, it should be inserted in `options`. */ - func createAll( // swiftlint:disable:this function_body_length cyclomatic_complexity + func createAll( batchLimit limit: Int? = nil, transaction: Bool = configuration.isUsingTransactions, options: API.Options = [], @@ -1307,7 +1308,7 @@ public extension Sequence where Element: ParseInstallation { - note: The default cache policy for this method is `.reloadIgnoringLocalCacheData`. If a developer desires a different policy, it should be inserted in `options`. */ - func replaceAll( // swiftlint:disable:this function_body_length cyclomatic_complexity + func replaceAll( batchLimit limit: Int? = nil, transaction: Bool = configuration.isUsingTransactions, options: API.Options = [], @@ -1363,7 +1364,7 @@ public extension Sequence where Element: ParseInstallation { - note: The default cache policy for this method is `.reloadIgnoringLocalCacheData`. If a developer desires a different policy, it should be inserted in `options`. */ - internal func updateAll( // swiftlint:disable:this function_body_length cyclomatic_complexity + internal func updateAll( batchLimit limit: Int? = nil, transaction: Bool = configuration.isUsingTransactions, options: API.Options = [], @@ -1401,6 +1402,7 @@ public extension Sequence where Element: ParseInstallation { #endif } + // swiftlint:disable:next cyclomatic_complexity function_body_length internal func batchCommand( // swiftlint:disable:this function_parameter_count method: Method, batchLimit limit: Int?, diff --git a/Sources/ParseSwift/Objects/ParseObject+async.swift b/Sources/ParseSwift/Objects/ParseObject+async.swift index 215dd81a2..7e6414c62 100644 --- a/Sources/ParseSwift/Objects/ParseObject+async.swift +++ b/Sources/ParseSwift/Objects/ParseObject+async.swift @@ -398,6 +398,7 @@ or disable transactions for this call. // MARK: Batch Support internal extension Sequence where Element: ParseObject { + // swiftlint:disable:next function_body_length func batchCommand(method: Method, batchLimit limit: Int?, transaction: Bool, diff --git a/Sources/ParseSwift/Objects/ParseObject.swift b/Sources/ParseSwift/Objects/ParseObject.swift index a24f82948..5f77477fd 100644 --- a/Sources/ParseSwift/Objects/ParseObject.swift +++ b/Sources/ParseSwift/Objects/ParseObject.swift @@ -509,7 +509,7 @@ transactions for this call. - note: The default cache policy for this method is `.reloadIgnoringLocalCacheData`. If a developer desires a different policy, it should be inserted in `options`. */ - func saveAll( // swiftlint:disable:this function_body_length cyclomatic_complexity + func saveAll( batchLimit limit: Int? = nil, transaction: Bool = configuration.isUsingTransactions, ignoringCustomObjectIdConfig: Bool = false, @@ -567,7 +567,7 @@ transactions for this call. - note: The default cache policy for this method is `.reloadIgnoringLocalCacheData`. If a developer desires a different policy, it should be inserted in `options`. */ - func createAll( // swiftlint:disable:this function_body_length cyclomatic_complexity + func createAll( batchLimit limit: Int? = nil, transaction: Bool = configuration.isUsingTransactions, options: API.Options = [], @@ -622,7 +622,7 @@ transactions for this call. - note: The default cache policy for this method is `.reloadIgnoringLocalCacheData`. If a developer desires a different policy, it should be inserted in `options`. */ - func replaceAll( // swiftlint:disable:this function_body_length cyclomatic_complexity + func replaceAll( batchLimit limit: Int? = nil, transaction: Bool = configuration.isUsingTransactions, options: API.Options = [], @@ -677,7 +677,7 @@ transactions for this call. - note: The default cache policy for this method is `.reloadIgnoringLocalCacheData`. If a developer desires a different policy, it should be inserted in `options`. */ - internal func updateAll( // swiftlint:disable:this function_body_length cyclomatic_complexity + internal func updateAll( batchLimit limit: Int? = nil, transaction: Bool = configuration.isUsingTransactions, options: API.Options = [], @@ -715,6 +715,7 @@ transactions for this call. #endif } + // swiftlint:disable:next function_body_length cyclomatic_complexity internal func batchCommand(method: Method, // swiftlint:disable:this function_parameter_count batchLimit limit: Int?, transaction: Bool, @@ -1492,10 +1493,10 @@ extension ParseObject { filesSavedBeforeThisOne: filesFinishedSaving) if waitingObjectInfo.unsavedChildren.count == 0 { - //If this ParseObject has no additional children, it can be saved now + // If this ParseObject has no additional children, it can be saved now savableObjects.append(parseObject) } else { - //Else this ParseObject needs to wait until it is children are saved + // Else this ParseObject needs to wait until it is children are saved nextBatch.append(parseObject) } } diff --git a/Sources/ParseSwift/Objects/ParseUser+async.swift b/Sources/ParseSwift/Objects/ParseUser+async.swift index b7a76aad3..022a8fcc8 100644 --- a/Sources/ParseSwift/Objects/ParseUser+async.swift +++ b/Sources/ParseSwift/Objects/ParseUser+async.swift @@ -541,6 +541,7 @@ internal extension ParseUser { // MARK: Batch Support internal extension Sequence where Element: ParseUser { + // swiftlint:disable:next function_body_length func batchCommand(method: Method, batchLimit limit: Int?, transaction: Bool, diff --git a/Sources/ParseSwift/Objects/ParseUser.swift b/Sources/ParseSwift/Objects/ParseUser.swift index 60509e65e..4b51471a7 100644 --- a/Sources/ParseSwift/Objects/ParseUser.swift +++ b/Sources/ParseSwift/Objects/ParseUser.swift @@ -1536,7 +1536,7 @@ public extension Sequence where Element: ParseUser { user.ensureDeepSave(options: options, // swiftlint:disable:next line_length isShouldReturnIfChildObjectsFound: transaction) { (savedChildObjects, savedChildFiles, parseError) -> Void in - //If an error occurs, everything should be skipped + // If an error occurs, everything should be skipped if parseError != nil { error = parseError } @@ -1618,7 +1618,7 @@ public extension Sequence where Element: ParseUser { - note: The default cache policy for this method is `.reloadIgnoringLocalCacheData`. If a developer desires a different policy, it should be inserted in `options`. */ - func saveAll( // swiftlint:disable:this function_body_length cyclomatic_complexity + func saveAll( batchLimit limit: Int? = nil, transaction: Bool = configuration.isUsingTransactions, ignoringCustomObjectIdConfig: Bool = false, @@ -1676,7 +1676,7 @@ public extension Sequence where Element: ParseUser { - note: The default cache policy for this method is `.reloadIgnoringLocalCacheData`. If a developer desires a different policy, it should be inserted in `options`. */ - func createAll( // swiftlint:disable:this function_body_length cyclomatic_complexity + func createAll( batchLimit limit: Int? = nil, transaction: Bool = configuration.isUsingTransactions, options: API.Options = [], @@ -1732,7 +1732,7 @@ public extension Sequence where Element: ParseUser { - note: The default cache policy for this method is `.reloadIgnoringLocalCacheData`. If a developer desires a different policy, it should be inserted in `options`. */ - func replaceAll( // swiftlint:disable:this function_body_length cyclomatic_complexity + func replaceAll( batchLimit limit: Int? = nil, transaction: Bool = configuration.isUsingTransactions, options: API.Options = [], @@ -1788,7 +1788,7 @@ public extension Sequence where Element: ParseUser { - note: The default cache policy for this method is `.reloadIgnoringLocalCacheData`. If a developer desires a different policy, it should be inserted in `options`. */ - internal func updateAll( // swiftlint:disable:this function_body_length cyclomatic_complexity + internal func updateAll( batchLimit limit: Int? = nil, transaction: Bool = configuration.isUsingTransactions, options: API.Options = [], @@ -1826,6 +1826,7 @@ public extension Sequence where Element: ParseUser { #endif } + // swiftlint:disable:next function_body_length cyclomatic_complexity internal func batchCommand( // swiftlint:disable:this function_parameter_count method: Method, batchLimit limit: Int?, diff --git a/Sources/ParseSwift/Parse.swift b/Sources/ParseSwift/Parse.swift index dd22ca338..c46bd8454 100644 --- a/Sources/ParseSwift/Parse.swift +++ b/Sources/ParseSwift/Parse.swift @@ -92,7 +92,7 @@ public var configuration: ParseConfiguration { - warning: Setting `usingDataProtectionKeychain` to **true** is known to cause issues in Playgrounds or in situtations when apps do not have credentials to setup a Keychain. */ -public func initialize(configuration: ParseConfiguration) { +public func initialize(configuration: ParseConfiguration) { // swiftlint:disable:this cyclomatic_complexity function_body_length Parse.configuration = configuration Parse.sessionDelegate = ParseURLSessionDelegate(callbackQueue: .main, authentication: configuration.authentication) diff --git a/Sources/ParseSwift/Storage/KeychainStore.swift b/Sources/ParseSwift/Storage/KeychainStore.swift index a5d4aa140..21feadcbe 100644 --- a/Sources/ParseSwift/Storage/KeychainStore.swift +++ b/Sources/ParseSwift/Storage/KeychainStore.swift @@ -13,6 +13,8 @@ import Security #if !os(Linux) && !os(Android) && !os(Windows) +// swiftlint:disable type_body_length + /** KeychainStore is UserDefaults-like wrapper on top of Keychain. It supports any object, with Coding support. All objects are available after the diff --git a/Sources/ParseSwift/Types/ParseACL.swift b/Sources/ParseSwift/Types/ParseACL.swift index 9df9b9bac..19ec841c8 100644 --- a/Sources/ParseSwift/Types/ParseACL.swift +++ b/Sources/ParseSwift/Types/ParseACL.swift @@ -8,6 +8,8 @@ import Foundation +// swiftlint:disable large_tuple + /** `ParseACL` is used to control which users can access or modify a particular `ParseObject`. Each `ParseObject` has its own ACL. You can grant read and write permissions separately diff --git a/Sources/ParseSwift/Types/Query.swift b/Sources/ParseSwift/Types/Query.swift index 0a2b9b7e3..54b81e0b9 100644 --- a/Sources/ParseSwift/Types/Query.swift +++ b/Sources/ParseSwift/Types/Query.swift @@ -8,6 +8,8 @@ import Foundation +// swiftlint:disable type_body_length + // MARK: Query /** The `Query` class defines a query that is used to query for `ParseObject`s. @@ -126,6 +128,7 @@ public struct Query: ParseTypeable where T: ParseObject { case pipeline } + // swiftlint:disable:next function_body_length public init(from decoder: Decoder) throws { let values = try decoder.container(keyedBy: CodingKeys.self) `where` = try values.decode(QueryWhere.self, forKey: .`where`) @@ -623,7 +626,7 @@ extension Query: Queryable { - warning: The items are processed in an unspecified order. The query may not have any sort order, and may not use limit or skip. */ - public func findAll(batchLimit limit: Int? = nil, + public func findAll(batchLimit limit: Int? = nil, // swiftlint:disable:this function_body_length options: API.Options = [], callbackQueue: DispatchQueue = .main, completion: @escaping (Result<[ResultType], ParseError>) -> Void) { @@ -1237,7 +1240,7 @@ extension Query: Queryable { `usingMongoDB` flag needs to be set for MongoDB users. See more [here](https://github.com/parse-community/parse-server/pull/7440). */ - public func aggregateExplain(_ pipeline: [[String: Encodable]], + public func aggregateExplain(_ pipeline: [[String: Encodable]], // swiftlint:disable:this function_body_length line_length usingMongoDB: Bool = false, options: API.Options = [], callbackQueue: DispatchQueue = .main, diff --git a/Sources/ParseSwift/Types/QueryConstraint.swift b/Sources/ParseSwift/Types/QueryConstraint.swift index 2a7e86049..7eeb48e07 100644 --- a/Sources/ParseSwift/Types/QueryConstraint.swift +++ b/Sources/ParseSwift/Types/QueryConstraint.swift @@ -28,7 +28,7 @@ public struct QueryConstraint: ParseTypeable, Hashable { case inQuery = "$inQuery" case notInQuery = "$notInQuery" case nearSphere = "$nearSphere" - case or = "$or" //swiftlint:disable:this identifier_name + case or = "$or" // swiftlint:disable:this identifier_name case and = "$and" case nor = "$nor" case relatedTo = "$relatedTo" @@ -155,7 +155,7 @@ public func == (key: String, value: T) -> QueryConstraint where T: Codable { */ public func equalTo (key: String, value: T, - //swiftlint:disable:next line_length + // swiftlint:disable:next line_length usingEqComparator: Bool = configuration.isUsingEqualQueryConstraint) -> QueryConstraint where T: Codable { if !usingEqComparator { return QueryConstraint(key: key, value: value) @@ -194,7 +194,7 @@ public func == (key: String, object: T) throws -> QueryConstraint where T: Pa */ public func equalTo (key: String, object: T, - //swiftlint:disable:next line_length + // swiftlint:disable:next line_length usingEqComparator: Bool = configuration.isUsingEqualQueryConstraint) throws -> QueryConstraint where T: ParseObject { if !usingEqComparator { return try QueryConstraint(key: key, value: object.toPointer()) diff --git a/Tests/ParseSwiftTests/APICommandTests.swift b/Tests/ParseSwiftTests/APICommandTests.swift index e3bfc83f4..d3ab942a5 100644 --- a/Tests/ParseSwiftTests/APICommandTests.swift +++ b/Tests/ParseSwiftTests/APICommandTests.swift @@ -10,6 +10,8 @@ import Foundation import XCTest @testable import ParseSwift +// swiftlint:disable type_body_length + class APICommandTests: XCTestCase { struct Level: ParseObject { @@ -155,7 +157,7 @@ class APICommandTests: XCTestCase { } } - //This is how errors from the server should typically come in + // This is how errors from the server should typically come in func testErrorFromParseServer() { let originalError = ParseError(code: .otherCause, message: "Could not decode") MockURLProtocol.mockRequests { _ in @@ -225,7 +227,7 @@ class APICommandTests: XCTestCase { } } - //This is how errors HTTP errors should typically come in + // This is how errors HTTP errors should typically come in func testErrorHTTP500JSON() { let parseError = ParseError(code: .connectionFailed, message: "Connection failed") let errorKey = "error" @@ -527,17 +529,18 @@ class APICommandTests: XCTestCase { let splitString = clientVersion .components(separatedBy: ParseConstants.sdk) XCTAssertEqual(splitString.count, 2) - //If successful, will remove `swift` resulting in "" + // If successful, will remove `swift` resulting in "" XCTAssertEqual(splitString[0], "") XCTAssertEqual(splitString[1], ParseConstants.version) - //Test incorrect split + // Test incorrect split let splitString2 = clientVersion .components(separatedBy: "hello") XCTAssertEqual(splitString2.count, 1) XCTAssertEqual(splitString2[0], clientVersion) } + // swiftlint:disable:next function_body_length cyclomatic_complexity func testClientVersionHeader() { let headers = API.getHeaders(options: []) XCTAssertEqual(headers["X-Parse-Client-Version"], API.clientVersion()) @@ -608,6 +611,7 @@ class APICommandTests: XCTestCase { } } + // swiftlint:disable:next function_body_length cyclomatic_complexity func testIdempodency() { let headers = API.getHeaders(options: []) XCTAssertNotNil(headers["X-Parse-Request-Id"]) @@ -678,6 +682,7 @@ class APICommandTests: XCTestCase { } } + // swiftlint:disable:next function_body_length cyclomatic_complexity func testIdempodencyNoParseBody() { let headers = API.getHeaders(options: []) XCTAssertNotNil(headers["X-Parse-Request-Id"]) diff --git a/Tests/ParseSwiftTests/AnyCodableTests/AnyCodableTests.swift b/Tests/ParseSwiftTests/AnyCodableTests/AnyCodableTests.swift index f23ff6373..ed71059a2 100755 --- a/Tests/ParseSwiftTests/AnyCodableTests/AnyCodableTests.swift +++ b/Tests/ParseSwiftTests/AnyCodableTests/AnyCodableTests.swift @@ -1,6 +1,8 @@ import XCTest @testable import ParseSwift +// swiftlint:disable function_body_length + class AnyCodableTests: XCTestCase { struct SomeCodable: Codable { @@ -55,7 +57,7 @@ class AnyCodableTests: XCTestCase { } } - //Test has objective-c + // Test has objective-c #if !os(Linux) && !os(Android) && !os(Windows) func testJSONEncoding() { diff --git a/Tests/ParseSwiftTests/AnyCodableTests/AnyEncodableTests.swift b/Tests/ParseSwiftTests/AnyCodableTests/AnyEncodableTests.swift index 9ffa44ebc..6f608c322 100755 --- a/Tests/ParseSwiftTests/AnyCodableTests/AnyEncodableTests.swift +++ b/Tests/ParseSwiftTests/AnyCodableTests/AnyEncodableTests.swift @@ -1,6 +1,8 @@ import XCTest @testable import ParseSwift +// swiftlint:disable function_body_length + // Test has objective-c #if !os(Linux) && !os(Android) && !os(Windows) class AnyEncodableTests: XCTestCase { diff --git a/Tests/ParseSwiftTests/IOS13Tests.swift b/Tests/ParseSwiftTests/IOS13Tests.swift index 19cca0361..70e34f16d 100644 --- a/Tests/ParseSwiftTests/IOS13Tests.swift +++ b/Tests/ParseSwiftTests/IOS13Tests.swift @@ -10,7 +10,7 @@ import Foundation import XCTest @testable import ParseSwift -class IOS13Tests: XCTestCase { // swiftlint:disable:this type_body_length +class IOS13Tests: XCTestCase { struct Level: ParseObject { var objectId: String? @@ -40,7 +40,7 @@ class IOS13Tests: XCTestCase { // swiftlint:disable:this type_body_length var level: Level? var levels: [Level]? - //custom initializers + // custom initializers init() {} init (objectId: String?) { self.objectId = objectId diff --git a/Tests/ParseSwiftTests/InitializeSDKTests.swift b/Tests/ParseSwiftTests/InitializeSDKTests.swift index 1fa415825..e0bafc03e 100644 --- a/Tests/ParseSwiftTests/InitializeSDKTests.swift +++ b/Tests/ParseSwiftTests/InitializeSDKTests.swift @@ -9,6 +9,8 @@ import XCTest @testable import ParseSwift +// swiftlint:disable function_body_length type_body_length + class InitializeSDKTests: XCTestCase { struct Installation: ParseInstallation { @@ -575,7 +577,7 @@ class InitializeSDKTests: XCTestCase { func testDeleteObjcSDKKeychain() throws { - //Set keychain the way objc sets keychain + // Set keychain the way objc sets keychain guard let objcParseKeychain = KeychainStore.objectiveC else { XCTFail("Should have unwrapped") return @@ -592,7 +594,7 @@ class InitializeSDKTests: XCTestCase { let retrievedInstallationId2: String? = objcParseKeychain.objectObjectiveC(forKey: "installationId") XCTAssertNil(retrievedInstallationId2) - //This is needed for tear down + // This is needed for tear down guard let url = URL(string: "http://localhost:1337/1") else { XCTFail("Should create valid URL") return @@ -606,7 +608,7 @@ class InitializeSDKTests: XCTestCase { func testMigrateObjcSDKMissingInstallation() { - //Set keychain the way objc sets keychain + // Set keychain the way objc sets keychain guard let objcParseKeychain = KeychainStore.objectiveC else { XCTFail("Should have unwrapped") return diff --git a/Tests/ParseSwiftTests/MigrateObjCSDKCombineTests.swift b/Tests/ParseSwiftTests/MigrateObjCSDKCombineTests.swift index 74e825b22..1725762b3 100644 --- a/Tests/ParseSwiftTests/MigrateObjCSDKCombineTests.swift +++ b/Tests/ParseSwiftTests/MigrateObjCSDKCombineTests.swift @@ -13,6 +13,8 @@ import XCTest import Combine @testable import ParseSwift +// swiftlint:disable type_body_length + class MigrateObjCSDKCombineTests: XCTestCase { struct User: ParseUser { @@ -441,7 +443,7 @@ class MigrateObjCSDKCombineTests: XCTestCase { let encoded: Data! do { encoded = try installationOnServer.getEncoder().encode(installationOnServer, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy installationOnServer = try installationOnServer.getDecoder().decode(Installation.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") diff --git a/Tests/ParseSwiftTests/MigrateObjCSDKTests.swift b/Tests/ParseSwiftTests/MigrateObjCSDKTests.swift index 64677f562..b61cb87d8 100644 --- a/Tests/ParseSwiftTests/MigrateObjCSDKTests.swift +++ b/Tests/ParseSwiftTests/MigrateObjCSDKTests.swift @@ -364,7 +364,7 @@ class MigrateObjCSDKTests: XCTestCase { // swiftlint:disable:this type_body_leng let encoded: Data! do { encoded = try installationOnServer.getEncoder().encode(installationOnServer, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy installationOnServer = try installationOnServer.getDecoder().decode(Installation.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") diff --git a/Tests/ParseSwiftTests/ParseACLTests.swift b/Tests/ParseSwiftTests/ParseACLTests.swift index 1ceddd274..8b1cd6358 100644 --- a/Tests/ParseSwiftTests/ParseACLTests.swift +++ b/Tests/ParseSwiftTests/ParseACLTests.swift @@ -10,6 +10,8 @@ import Foundation import XCTest @testable import ParseSwift +// swiftlint:disable type_body_length + class ParseACLTests: XCTestCase { override func setUpWithError() throws { diff --git a/Tests/ParseSwiftTests/ParseAnalyticsAsyncTests.swift b/Tests/ParseSwiftTests/ParseAnalyticsAsyncTests.swift index 634f4e076..a87ab0a4b 100644 --- a/Tests/ParseSwiftTests/ParseAnalyticsAsyncTests.swift +++ b/Tests/ParseSwiftTests/ParseAnalyticsAsyncTests.swift @@ -14,7 +14,7 @@ import FoundationNetworking import XCTest @testable import ParseSwift -class ParseAnalyticsAsyncTests: XCTestCase { // swiftlint:disable:this type_body_length +class ParseAnalyticsAsyncTests: XCTestCase { override func setUpWithError() throws { try super.setUpWithError() guard let url = URL(string: "http://localhost:1337/1") else { diff --git a/Tests/ParseSwiftTests/ParseAnalyticsCombineTests.swift b/Tests/ParseSwiftTests/ParseAnalyticsCombineTests.swift index 12fdfdbe9..917e9cb30 100644 --- a/Tests/ParseSwiftTests/ParseAnalyticsCombineTests.swift +++ b/Tests/ParseSwiftTests/ParseAnalyticsCombineTests.swift @@ -13,7 +13,7 @@ import XCTest import Combine @testable import ParseSwift -class ParseAnalyticsCombineTests: XCTestCase { // swiftlint:disable:this type_body_length +class ParseAnalyticsCombineTests: XCTestCase { override func setUpWithError() throws { try super.setUpWithError() diff --git a/Tests/ParseSwiftTests/ParseAnalyticsTests.swift b/Tests/ParseSwiftTests/ParseAnalyticsTests.swift index dfdfe2411..586dc0a12 100644 --- a/Tests/ParseSwiftTests/ParseAnalyticsTests.swift +++ b/Tests/ParseSwiftTests/ParseAnalyticsTests.swift @@ -10,6 +10,8 @@ import Foundation import XCTest @testable import ParseSwift +// swiftlint:disable type_body_length + class ParseAnalyticsTests: XCTestCase { override func setUpWithError() throws { @@ -54,7 +56,7 @@ class ParseAnalyticsTests: XCTestCase { XCTAssertEqual(command2.body?.date, date) XCTAssertNotNil(command2.body?.dimensions) - event2.date = nil //Clear date for comparison + event2.date = nil // Clear date for comparison let decoded = event2.debugDescription let expected = "{\"dimensions\":{\"stop\":\"drop\"},\"name\":\"hello\"}" XCTAssertEqual(decoded, expected) diff --git a/Tests/ParseSwiftTests/ParseAnonymousAsyncTests.swift b/Tests/ParseSwiftTests/ParseAnonymousAsyncTests.swift index 4181d5881..5e88609bd 100644 --- a/Tests/ParseSwiftTests/ParseAnonymousAsyncTests.swift +++ b/Tests/ParseSwiftTests/ParseAnonymousAsyncTests.swift @@ -14,7 +14,7 @@ import FoundationNetworking import XCTest @testable import ParseSwift -class ParseAnonymousAsyncTests: XCTestCase { // swiftlint:disable:this type_body_length +class ParseAnonymousAsyncTests: XCTestCase { struct User: ParseUser { //: These are required by ParseObject @@ -103,7 +103,7 @@ class ParseAnonymousAsyncTests: XCTestCase { // swiftlint:disable:this type_body let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -139,7 +139,7 @@ class ParseAnonymousAsyncTests: XCTestCase { // swiftlint:disable:this type_body let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") diff --git a/Tests/ParseSwiftTests/ParseAnonymousCombineTests.swift b/Tests/ParseSwiftTests/ParseAnonymousCombineTests.swift index bf466fb63..83b351ca2 100644 --- a/Tests/ParseSwiftTests/ParseAnonymousCombineTests.swift +++ b/Tests/ParseSwiftTests/ParseAnonymousCombineTests.swift @@ -13,7 +13,7 @@ import XCTest import Combine @testable import ParseSwift -class ParseAnonymousCombineTests: XCTestCase { // swiftlint:disable:this type_body_length +class ParseAnonymousCombineTests: XCTestCase { struct User: ParseUser { @@ -104,7 +104,7 @@ class ParseAnonymousCombineTests: XCTestCase { // swiftlint:disable:this type_bo let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -154,7 +154,7 @@ class ParseAnonymousCombineTests: XCTestCase { // swiftlint:disable:this type_bo let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") diff --git a/Tests/ParseSwiftTests/ParseAnonymousTests.swift b/Tests/ParseSwiftTests/ParseAnonymousTests.swift index 4c4e6ba8a..427af61e0 100644 --- a/Tests/ParseSwiftTests/ParseAnonymousTests.swift +++ b/Tests/ParseSwiftTests/ParseAnonymousTests.swift @@ -10,6 +10,8 @@ import Foundation import XCTest @testable import ParseSwift +// swiftlint:disable type_body_length + class ParseAnonymousTests: XCTestCase { struct User: ParseUser { @@ -138,7 +140,7 @@ class ParseAnonymousTests: XCTestCase { let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -172,7 +174,7 @@ class ParseAnonymousTests: XCTestCase { let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -206,7 +208,7 @@ class ParseAnonymousTests: XCTestCase { let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -251,7 +253,7 @@ class ParseAnonymousTests: XCTestCase { let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -295,7 +297,7 @@ class ParseAnonymousTests: XCTestCase { let encoded: Data! do { encoded = try ParseCoding.jsonEncoder().encode(response) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy response = try ParseCoding.jsonDecoder().decode(UpdateSessionTokenResponse.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -342,7 +344,7 @@ class ParseAnonymousTests: XCTestCase { let encoded: Data! do { encoded = try ParseCoding.jsonEncoder().encode(response) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy response = try ParseCoding.jsonDecoder().decode(UpdateSessionTokenResponse.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -387,7 +389,7 @@ class ParseAnonymousTests: XCTestCase { let encoded: Data! do { encoded = try ParseCoding.jsonEncoder().encode(response) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy response = try ParseCoding.jsonDecoder().decode(UpdateSessionTokenResponse.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -425,7 +427,7 @@ class ParseAnonymousTests: XCTestCase { let encoded: Data! do { encoded = try ParseCoding.jsonEncoder().encode(response) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy response = try ParseCoding.jsonDecoder().decode(UpdateSessionTokenResponse.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -508,7 +510,7 @@ class ParseAnonymousTests: XCTestCase { let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -538,12 +540,12 @@ class ParseAnonymousTests: XCTestCase { XCTAssertGreaterThan(becomeUpdatedAt, originalUpdatedAt) XCTAssertNil(become.ACL) - //Should be updated in memory + // Should be updated in memory XCTAssertEqual(User.current?.updatedAt, becomeUpdatedAt) XCTAssertFalse(User.anonymous.isLinked) #if !os(Linux) && !os(Android) && !os(Windows) - //Should be updated in Keychain + // Should be updated in Keychain guard let keychainUser: CurrentUserContainer = try? KeychainStore.shared.get(valueFor: ParseStorage.Keys.currentUser) else { XCTFail("Should get object from Keychain") diff --git a/Tests/ParseSwiftTests/ParseAppleAsyncTests.swift b/Tests/ParseSwiftTests/ParseAppleAsyncTests.swift index 64badec4c..9e499950c 100644 --- a/Tests/ParseSwiftTests/ParseAppleAsyncTests.swift +++ b/Tests/ParseSwiftTests/ParseAppleAsyncTests.swift @@ -14,7 +14,7 @@ import FoundationNetworking import XCTest @testable import ParseSwift -class ParseAppleAsyncTests: XCTestCase { // swiftlint:disable:this type_body_length +class ParseAppleAsyncTests: XCTestCase { struct User: ParseUser { //: These are required by ParseObject @@ -103,7 +103,7 @@ class ParseAppleAsyncTests: XCTestCase { // swiftlint:disable:this type_body_len let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -143,7 +143,7 @@ class ParseAppleAsyncTests: XCTestCase { // swiftlint:disable:this type_body_len let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -189,7 +189,7 @@ class ParseAppleAsyncTests: XCTestCase { // swiftlint:disable:this type_body_len let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -226,7 +226,7 @@ class ParseAppleAsyncTests: XCTestCase { // swiftlint:disable:this type_body_len let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -270,7 +270,7 @@ class ParseAppleAsyncTests: XCTestCase { // swiftlint:disable:this type_body_len let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") diff --git a/Tests/ParseSwiftTests/ParseAppleCombineTests.swift b/Tests/ParseSwiftTests/ParseAppleCombineTests.swift index 31d1426a5..bd5406d8b 100644 --- a/Tests/ParseSwiftTests/ParseAppleCombineTests.swift +++ b/Tests/ParseSwiftTests/ParseAppleCombineTests.swift @@ -105,7 +105,7 @@ class ParseAppleCombineTests: XCTestCase { // swiftlint:disable:this type_body_l let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -160,7 +160,7 @@ class ParseAppleCombineTests: XCTestCase { // swiftlint:disable:this type_body_l let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -221,7 +221,7 @@ class ParseAppleCombineTests: XCTestCase { // swiftlint:disable:this type_body_l let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -273,7 +273,7 @@ class ParseAppleCombineTests: XCTestCase { // swiftlint:disable:this type_body_l let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -332,7 +332,7 @@ class ParseAppleCombineTests: XCTestCase { // swiftlint:disable:this type_body_l let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") diff --git a/Tests/ParseSwiftTests/ParseAppleTests.swift b/Tests/ParseSwiftTests/ParseAppleTests.swift index 09c7f0e38..4b2f1fba7 100644 --- a/Tests/ParseSwiftTests/ParseAppleTests.swift +++ b/Tests/ParseSwiftTests/ParseAppleTests.swift @@ -10,6 +10,8 @@ import Foundation import XCTest @testable import ParseSwift +// swiftlint:disable type_body_length + class ParseAppleTests: XCTestCase { struct User: ParseUser { @@ -140,7 +142,7 @@ class ParseAppleTests: XCTestCase { let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -162,7 +164,7 @@ class ParseAppleTests: XCTestCase { XCTAssertEqual(user.password, "world") XCTAssertTrue(user.apple.isLinked) - //Test stripping + // Test stripping user.apple.strip() XCTAssertFalse(user.apple.isLinked) case .failure(let error): @@ -196,7 +198,7 @@ class ParseAppleTests: XCTestCase { let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -218,7 +220,7 @@ class ParseAppleTests: XCTestCase { XCTAssertEqual(user.password, "world") XCTAssertTrue(user.apple.isLinked) - //Test stripping + // Test stripping user.apple.strip() XCTAssertFalse(user.apple.isLinked) case .failure(let error): @@ -265,7 +267,7 @@ class ParseAppleTests: XCTestCase { let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -310,7 +312,7 @@ class ParseAppleTests: XCTestCase { let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -351,7 +353,7 @@ class ParseAppleTests: XCTestCase { let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -399,7 +401,7 @@ class ParseAppleTests: XCTestCase { let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -448,7 +450,7 @@ class ParseAppleTests: XCTestCase { let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -528,7 +530,7 @@ class ParseAppleTests: XCTestCase { let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") diff --git a/Tests/ParseSwiftTests/ParseAuthenticationAsyncTests.swift b/Tests/ParseSwiftTests/ParseAuthenticationAsyncTests.swift index 2ad0c495b..4bf111527 100644 --- a/Tests/ParseSwiftTests/ParseAuthenticationAsyncTests.swift +++ b/Tests/ParseSwiftTests/ParseAuthenticationAsyncTests.swift @@ -17,7 +17,7 @@ import XCTest import Combine #endif -class ParseAuthenticationAsyncTests: XCTestCase { // swiftlint:disable:this type_body_length +class ParseAuthenticationAsyncTests: XCTestCase { struct User: ParseUser { //: These are required by ParseObject @@ -160,7 +160,7 @@ class ParseAuthenticationAsyncTests: XCTestCase { // swiftlint:disable:this type let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -207,7 +207,7 @@ class ParseAuthenticationAsyncTests: XCTestCase { // swiftlint:disable:this type let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") diff --git a/Tests/ParseSwiftTests/ParseAuthenticationCombineTests.swift b/Tests/ParseSwiftTests/ParseAuthenticationCombineTests.swift index 73156dcad..737b6aac5 100644 --- a/Tests/ParseSwiftTests/ParseAuthenticationCombineTests.swift +++ b/Tests/ParseSwiftTests/ParseAuthenticationCombineTests.swift @@ -161,7 +161,7 @@ class ParseAuthenticationCombineTests: XCTestCase { let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -222,7 +222,7 @@ class ParseAuthenticationCombineTests: XCTestCase { let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") diff --git a/Tests/ParseSwiftTests/ParseCloudableAsyncTests.swift b/Tests/ParseSwiftTests/ParseCloudableAsyncTests.swift index 16d378108..6073b0e47 100644 --- a/Tests/ParseSwiftTests/ParseCloudableAsyncTests.swift +++ b/Tests/ParseSwiftTests/ParseCloudableAsyncTests.swift @@ -14,7 +14,7 @@ import FoundationNetworking import XCTest @testable import ParseSwift -class ParseCloudableAsyncTests: XCTestCase { // swiftlint:disable:this type_body_length +class ParseCloudableAsyncTests: XCTestCase { struct Cloud: ParseCloudable { typealias ReturnType = String? // swiftlint:disable:this nesting diff --git a/Tests/ParseSwiftTests/ParseCloudableCombineTests.swift b/Tests/ParseSwiftTests/ParseCloudableCombineTests.swift index 0f826e9a8..b144298fa 100644 --- a/Tests/ParseSwiftTests/ParseCloudableCombineTests.swift +++ b/Tests/ParseSwiftTests/ParseCloudableCombineTests.swift @@ -13,7 +13,7 @@ import XCTest import Combine @testable import ParseSwift -class ParseCloudableCombineTests: XCTestCase { // swiftlint:disable:this type_body_length +class ParseCloudableCombineTests: XCTestCase { struct Cloud: ParseCloudable { typealias ReturnType = String? // swiftlint:disable:this nesting diff --git a/Tests/ParseSwiftTests/ParseConfigAsyncTests.swift b/Tests/ParseSwiftTests/ParseConfigAsyncTests.swift index 4776da859..4ca39855a 100644 --- a/Tests/ParseSwiftTests/ParseConfigAsyncTests.swift +++ b/Tests/ParseSwiftTests/ParseConfigAsyncTests.swift @@ -14,7 +14,7 @@ import FoundationNetworking import XCTest @testable import ParseSwift -class ParseConfigAsyncTests: XCTestCase { // swiftlint:disable:this type_body_length +class ParseConfigAsyncTests: XCTestCase { struct Config: ParseConfig { var welcomeMessage: String? var winningNumber: Int? @@ -141,7 +141,7 @@ class ParseConfigAsyncTests: XCTestCase { // swiftlint:disable:this type_body_le XCTAssertEqual(Config.current?.welcomeMessage, configOnServer.welcomeMessage) #if !os(Linux) && !os(Android) && !os(Windows) - //Should be updated in Keychain + // Should be updated in Keychain guard let keychainConfig: CurrentConfigContainer = try? KeychainStore.shared.get(valueFor: ParseStorage.Keys.currentConfig) else { XCTFail("Should get object from Keychain") @@ -176,7 +176,7 @@ class ParseConfigAsyncTests: XCTestCase { // swiftlint:disable:this type_body_le XCTAssertEqual(Config.current?.welcomeMessage, config.welcomeMessage) #if !os(Linux) && !os(Android) && !os(Windows) - //Should be updated in Keychain + // Should be updated in Keychain guard let keychainConfig: CurrentConfigContainer = try? KeychainStore.shared.get(valueFor: ParseStorage.Keys.currentConfig) else { XCTFail("Should get object from Keychain") diff --git a/Tests/ParseSwiftTests/ParseConfigCombineTests.swift b/Tests/ParseSwiftTests/ParseConfigCombineTests.swift index 94bbee2fc..85dfcd091 100644 --- a/Tests/ParseSwiftTests/ParseConfigCombineTests.swift +++ b/Tests/ParseSwiftTests/ParseConfigCombineTests.swift @@ -13,7 +13,7 @@ import XCTest import Combine @testable import ParseSwift -class ParseConfigCombineTests: XCTestCase { // swiftlint:disable:this type_body_length +class ParseConfigCombineTests: XCTestCase { struct Config: ParseConfig { var welcomeMessage: String? @@ -151,7 +151,7 @@ class ParseConfigCombineTests: XCTestCase { // swiftlint:disable:this type_body_ XCTAssertEqual(Config.current?.welcomeMessage, configOnServer.welcomeMessage) #if !os(Linux) && !os(Android) && !os(Windows) - //Should be updated in Keychain + // Should be updated in Keychain guard let keychainConfig: CurrentConfigContainer = try? KeychainStore.shared.get(valueFor: ParseStorage.Keys.currentConfig) else { XCTFail("Should get object from Keychain") @@ -200,7 +200,7 @@ class ParseConfigCombineTests: XCTestCase { // swiftlint:disable:this type_body_ XCTAssertEqual(Config.current?.welcomeMessage, config.welcomeMessage) #if !os(Linux) && !os(Android) && !os(Windows) - //Should be updated in Keychain + // Should be updated in Keychain guard let keychainConfig: CurrentConfigContainer = try? KeychainStore.shared.get(valueFor: ParseStorage.Keys.currentConfig) else { XCTFail("Should get object from Keychain") diff --git a/Tests/ParseSwiftTests/ParseConfigTests.swift b/Tests/ParseSwiftTests/ParseConfigTests.swift index 3d96131be..302aa0393 100644 --- a/Tests/ParseSwiftTests/ParseConfigTests.swift +++ b/Tests/ParseSwiftTests/ParseConfigTests.swift @@ -192,7 +192,7 @@ class ParseConfigTests: XCTestCase { // swiftlint:disable:this type_body_length XCTAssertEqual(Config.current?.welcomeMessage, configOnServer.welcomeMessage) #if !os(Linux) && !os(Android) && !os(Windows) - //Should be updated in Keychain + // Should be updated in Keychain guard let keychainConfig: CurrentConfigContainer = try? KeychainStore.shared.get(valueFor: ParseStorage.Keys.currentConfig) else { XCTFail("Should get object from Keychain") @@ -234,7 +234,7 @@ class ParseConfigTests: XCTestCase { // swiftlint:disable:this type_body_length XCTAssertEqual(Config.current?.welcomeMessage, configOnServer.welcomeMessage) #if !os(Linux) && !os(Android) && !os(Windows) - //Should be updated in Keychain + // Should be updated in Keychain guard let keychainConfig: CurrentConfigContainer = try? KeychainStore.shared.get(valueFor: ParseStorage.Keys.currentConfig) else { XCTFail("Should get object from Keychain") @@ -284,7 +284,7 @@ class ParseConfigTests: XCTestCase { // swiftlint:disable:this type_body_length XCTAssertEqual(Config.current?.welcomeMessage, config.welcomeMessage) #if !os(Linux) && !os(Android) && !os(Windows) - //Should be updated in Keychain + // Should be updated in Keychain guard let keychainConfig: CurrentConfigContainer = try? KeychainStore.shared.get(valueFor: ParseStorage.Keys.currentConfig) else { XCTFail("Should get object from Keychain") @@ -324,7 +324,7 @@ class ParseConfigTests: XCTestCase { // swiftlint:disable:this type_body_length XCTAssertEqual(Config.current?.welcomeMessage, config.welcomeMessage) #if !os(Linux) && !os(Android) && !os(Windows) - //Should be updated in Keychain + // Should be updated in Keychain guard let keychainConfig: CurrentConfigContainer = try? KeychainStore.shared.get(valueFor: ParseStorage.Keys.currentConfig) else { XCTFail("Should get object from Keychain") diff --git a/Tests/ParseSwiftTests/ParseFacebookAsyncTests.swift b/Tests/ParseSwiftTests/ParseFacebookAsyncTests.swift index 33432e0ab..995c085ef 100644 --- a/Tests/ParseSwiftTests/ParseFacebookAsyncTests.swift +++ b/Tests/ParseSwiftTests/ParseFacebookAsyncTests.swift @@ -103,7 +103,7 @@ class ParseFacebookAsyncTests: XCTestCase { // swiftlint:disable:this type_body_ let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -139,7 +139,7 @@ class ParseFacebookAsyncTests: XCTestCase { // swiftlint:disable:this type_body_ let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -175,7 +175,7 @@ class ParseFacebookAsyncTests: XCTestCase { // swiftlint:disable:this type_body_ let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -226,7 +226,7 @@ class ParseFacebookAsyncTests: XCTestCase { // swiftlint:disable:this type_body_ let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -260,7 +260,7 @@ class ParseFacebookAsyncTests: XCTestCase { // swiftlint:disable:this type_body_ let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -294,7 +294,7 @@ class ParseFacebookAsyncTests: XCTestCase { // swiftlint:disable:this type_body_ let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -339,7 +339,7 @@ class ParseFacebookAsyncTests: XCTestCase { // swiftlint:disable:this type_body_ let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -378,7 +378,7 @@ class ParseFacebookAsyncTests: XCTestCase { // swiftlint:disable:this type_body_ let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") diff --git a/Tests/ParseSwiftTests/ParseFacebookCombineTests.swift b/Tests/ParseSwiftTests/ParseFacebookCombineTests.swift index 2a9f0de20..d350e157d 100644 --- a/Tests/ParseSwiftTests/ParseFacebookCombineTests.swift +++ b/Tests/ParseSwiftTests/ParseFacebookCombineTests.swift @@ -103,7 +103,7 @@ class ParseFacebookCombineTests: XCTestCase { // swiftlint:disable:this type_bod let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -153,7 +153,7 @@ class ParseFacebookCombineTests: XCTestCase { // swiftlint:disable:this type_bod let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -202,7 +202,7 @@ class ParseFacebookCombineTests: XCTestCase { // swiftlint:disable:this type_bod let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -266,7 +266,7 @@ class ParseFacebookCombineTests: XCTestCase { // swiftlint:disable:this type_bod let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -312,7 +312,7 @@ class ParseFacebookCombineTests: XCTestCase { // swiftlint:disable:this type_bod let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -359,7 +359,7 @@ class ParseFacebookCombineTests: XCTestCase { // swiftlint:disable:this type_bod let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -417,7 +417,7 @@ class ParseFacebookCombineTests: XCTestCase { // swiftlint:disable:this type_bod let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -469,7 +469,7 @@ class ParseFacebookCombineTests: XCTestCase { // swiftlint:disable:this type_bod let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") diff --git a/Tests/ParseSwiftTests/ParseFacebookTests.swift b/Tests/ParseSwiftTests/ParseFacebookTests.swift index ab12a4c57..0f5f0e493 100644 --- a/Tests/ParseSwiftTests/ParseFacebookTests.swift +++ b/Tests/ParseSwiftTests/ParseFacebookTests.swift @@ -10,6 +10,8 @@ import Foundation import XCTest @testable import ParseSwift +// swiftlint:disable type_body_length + class ParseFacebookTests: XCTestCase { struct User: ParseUser { @@ -185,7 +187,7 @@ class ParseFacebookTests: XCTestCase { let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -208,7 +210,7 @@ class ParseFacebookTests: XCTestCase { XCTAssertEqual(user.password, "world") XCTAssertTrue(user.facebook.isLinked) - //Test stripping + // Test stripping user.facebook.strip() XCTAssertFalse(user.facebook.isLinked) case .failure(let error): @@ -238,7 +240,7 @@ class ParseFacebookTests: XCTestCase { let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -261,7 +263,7 @@ class ParseFacebookTests: XCTestCase { XCTAssertEqual(user.password, "world") XCTAssertTrue(user.facebook.isLinked) - //Test stripping + // Test stripping user.facebook.strip() XCTAssertFalse(user.facebook.isLinked) case .failure(let error): @@ -291,7 +293,7 @@ class ParseFacebookTests: XCTestCase { let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -313,7 +315,7 @@ class ParseFacebookTests: XCTestCase { XCTAssertEqual(user.password, "world") XCTAssertTrue(user.facebook.isLinked) - //Test stripping + // Test stripping user.facebook.strip() XCTAssertFalse(user.facebook.isLinked) case .failure(let error): @@ -362,7 +364,7 @@ class ParseFacebookTests: XCTestCase { let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -403,7 +405,7 @@ class ParseFacebookTests: XCTestCase { let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -457,7 +459,7 @@ class ParseFacebookTests: XCTestCase { let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -499,7 +501,7 @@ class ParseFacebookTests: XCTestCase { let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -541,7 +543,7 @@ class ParseFacebookTests: XCTestCase { let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -584,7 +586,7 @@ class ParseFacebookTests: XCTestCase { let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -629,7 +631,7 @@ class ParseFacebookTests: XCTestCase { let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -672,7 +674,7 @@ class ParseFacebookTests: XCTestCase { let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -747,7 +749,7 @@ class ParseFacebookTests: XCTestCase { let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -795,7 +797,7 @@ class ParseFacebookTests: XCTestCase { let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") diff --git a/Tests/ParseSwiftTests/ParseFileAsyncTests.swift b/Tests/ParseSwiftTests/ParseFileAsyncTests.swift index 6bf1f0afe..58a8235b3 100644 --- a/Tests/ParseSwiftTests/ParseFileAsyncTests.swift +++ b/Tests/ParseSwiftTests/ParseFileAsyncTests.swift @@ -69,7 +69,7 @@ class ParseFileAsyncTests: XCTestCase { // swiftlint:disable:this type_body_leng } #if !os(Linux) && !os(Android) && !os(Windows) - //URL Mocker is not able to mock this in linux and tests fail, so do not run. + // URL Mocker is not able to mock this in linux and tests fail, so do not run. @MainActor func testFetch() async throws { diff --git a/Tests/ParseSwiftTests/ParseFileCombineTests.swift b/Tests/ParseSwiftTests/ParseFileCombineTests.swift index 2dd675587..04981ea78 100644 --- a/Tests/ParseSwiftTests/ParseFileCombineTests.swift +++ b/Tests/ParseSwiftTests/ParseFileCombineTests.swift @@ -13,7 +13,7 @@ import XCTest import Combine @testable import ParseSwift -class ParseFileCombineTests: XCTestCase { // swiftlint:disable:this type_body_length +class ParseFileCombineTests: XCTestCase { let temporaryDirectory = "\(NSTemporaryDirectory())test/" diff --git a/Tests/ParseSwiftTests/ParseFileTransferableTests.swift b/Tests/ParseSwiftTests/ParseFileTransferableTests.swift index a98236e3d..99134ce1e 100644 --- a/Tests/ParseSwiftTests/ParseFileTransferableTests.swift +++ b/Tests/ParseSwiftTests/ParseFileTransferableTests.swift @@ -13,6 +13,8 @@ import FoundationNetworking import XCTest @testable import ParseSwift +// swiftlint:disable type_body_length + class ParseFileTransferableTests: XCTestCase { let temporaryDirectory = "\(NSTemporaryDirectory())test/" diff --git a/Tests/ParseSwiftTests/ParseGitHubCombineTests.swift b/Tests/ParseSwiftTests/ParseGitHubCombineTests.swift index 7e069f64b..74dd7e174 100644 --- a/Tests/ParseSwiftTests/ParseGitHubCombineTests.swift +++ b/Tests/ParseSwiftTests/ParseGitHubCombineTests.swift @@ -105,7 +105,7 @@ class ParseGitHubCombineTests: XCTestCase { // swiftlint:disable:this type_body_ let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -155,7 +155,7 @@ class ParseGitHubCombineTests: XCTestCase { // swiftlint:disable:this type_body_ let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -216,7 +216,7 @@ class ParseGitHubCombineTests: XCTestCase { // swiftlint:disable:this type_body_ let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -264,7 +264,7 @@ class ParseGitHubCombineTests: XCTestCase { // swiftlint:disable:this type_body_ let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -319,7 +319,7 @@ class ParseGitHubCombineTests: XCTestCase { // swiftlint:disable:this type_body_ let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") diff --git a/Tests/ParseSwiftTests/ParseGitHubTests.swift b/Tests/ParseSwiftTests/ParseGitHubTests.swift index f5c58eee0..0dd62589a 100644 --- a/Tests/ParseSwiftTests/ParseGitHubTests.swift +++ b/Tests/ParseSwiftTests/ParseGitHubTests.swift @@ -116,7 +116,7 @@ class ParseGitHubTests: XCTestCase { // swiftlint:disable:this type_body_length let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -169,7 +169,7 @@ class ParseGitHubTests: XCTestCase { // swiftlint:disable:this type_body_length let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -206,7 +206,7 @@ class ParseGitHubTests: XCTestCase { // swiftlint:disable:this type_body_length let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -252,7 +252,7 @@ class ParseGitHubTests: XCTestCase { // swiftlint:disable:this type_body_length let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -285,7 +285,7 @@ class ParseGitHubTests: XCTestCase { // swiftlint:disable:this type_body_length let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -319,7 +319,7 @@ class ParseGitHubTests: XCTestCase { // swiftlint:disable:this type_body_length let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -354,7 +354,7 @@ class ParseGitHubTests: XCTestCase { // swiftlint:disable:this type_body_length let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -411,7 +411,7 @@ class ParseGitHubTests: XCTestCase { // swiftlint:disable:this type_body_length let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") diff --git a/Tests/ParseSwiftTests/ParseGoogleCombineTests.swift b/Tests/ParseSwiftTests/ParseGoogleCombineTests.swift index 87c77144a..f9cbdfa22 100644 --- a/Tests/ParseSwiftTests/ParseGoogleCombineTests.swift +++ b/Tests/ParseSwiftTests/ParseGoogleCombineTests.swift @@ -105,7 +105,7 @@ class ParseGoogleCombineTests: XCTestCase { // swiftlint:disable:this type_body_ let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -155,7 +155,7 @@ class ParseGoogleCombineTests: XCTestCase { // swiftlint:disable:this type_body_ let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -216,7 +216,7 @@ class ParseGoogleCombineTests: XCTestCase { // swiftlint:disable:this type_body_ let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -264,7 +264,7 @@ class ParseGoogleCombineTests: XCTestCase { // swiftlint:disable:this type_body_ let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -319,7 +319,7 @@ class ParseGoogleCombineTests: XCTestCase { // swiftlint:disable:this type_body_ let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") diff --git a/Tests/ParseSwiftTests/ParseGoogleTests.swift b/Tests/ParseSwiftTests/ParseGoogleTests.swift index 738b1e557..b26094539 100644 --- a/Tests/ParseSwiftTests/ParseGoogleTests.swift +++ b/Tests/ParseSwiftTests/ParseGoogleTests.swift @@ -116,7 +116,7 @@ class ParseGoogleTests: XCTestCase { // swiftlint:disable:this type_body_length let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -181,7 +181,7 @@ class ParseGoogleTests: XCTestCase { // swiftlint:disable:this type_body_length let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -219,7 +219,7 @@ class ParseGoogleTests: XCTestCase { // swiftlint:disable:this type_body_length let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -265,7 +265,7 @@ class ParseGoogleTests: XCTestCase { // swiftlint:disable:this type_body_length let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -299,7 +299,7 @@ class ParseGoogleTests: XCTestCase { // swiftlint:disable:this type_body_length let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -334,7 +334,7 @@ class ParseGoogleTests: XCTestCase { // swiftlint:disable:this type_body_length let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -370,7 +370,7 @@ class ParseGoogleTests: XCTestCase { // swiftlint:disable:this type_body_length let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -427,7 +427,7 @@ class ParseGoogleTests: XCTestCase { // swiftlint:disable:this type_body_length let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") diff --git a/Tests/ParseSwiftTests/ParseHealthAsyncTests.swift b/Tests/ParseSwiftTests/ParseHealthAsyncTests.swift index 6b3a14ca4..0786c0c2f 100644 --- a/Tests/ParseSwiftTests/ParseHealthAsyncTests.swift +++ b/Tests/ParseSwiftTests/ParseHealthAsyncTests.swift @@ -14,7 +14,7 @@ import FoundationNetworking import XCTest @testable import ParseSwift -class ParseHealthAsyncTests: XCTestCase { // swiftlint:disable:this type_body_length +class ParseHealthAsyncTests: XCTestCase { override func setUpWithError() throws { try super.setUpWithError() guard let url = URL(string: "http://localhost:1337/1") else { diff --git a/Tests/ParseSwiftTests/ParseHookFunctionRequestCombineTests.swift b/Tests/ParseSwiftTests/ParseHookFunctionRequestCombineTests.swift index 469d67d92..e338be009 100644 --- a/Tests/ParseSwiftTests/ParseHookFunctionRequestCombineTests.swift +++ b/Tests/ParseSwiftTests/ParseHookFunctionRequestCombineTests.swift @@ -82,7 +82,7 @@ class ParseHookFunctionRequestCombineTests: XCTestCase { userOnServer.updatedAt = Date() var server = userOnServer let encoded = try ParseCoding.jsonEncoder().encode(server) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy server = try ParseCoding.jsonDecoder().decode(User.self, from: encoded) MockURLProtocol.mockRequests { _ in return MockURLResponse(data: encoded, statusCode: 200, delay: 0.0) diff --git a/Tests/ParseSwiftTests/ParseHookFunctionRequestTests.swift b/Tests/ParseSwiftTests/ParseHookFunctionRequestTests.swift index 667afff58..c5be725db 100644 --- a/Tests/ParseSwiftTests/ParseHookFunctionRequestTests.swift +++ b/Tests/ParseSwiftTests/ParseHookFunctionRequestTests.swift @@ -204,7 +204,7 @@ class ParseHookFunctionRequestTests: XCTestCase { userOnServer.updatedAt = Date() var server = userOnServer let encoded = try ParseCoding.jsonEncoder().encode(server) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy server = try ParseCoding.jsonDecoder().decode(User.self, from: encoded) MockURLProtocol.mockRequests { _ in return MockURLResponse(data: encoded, statusCode: 200, delay: 0.0) diff --git a/Tests/ParseSwiftTests/ParseHookTriggerCombineTests.swift b/Tests/ParseSwiftTests/ParseHookTriggerCombineTests.swift index 4eb6a5412..f6d8ccebd 100644 --- a/Tests/ParseSwiftTests/ParseHookTriggerCombineTests.swift +++ b/Tests/ParseSwiftTests/ParseHookTriggerCombineTests.swift @@ -13,6 +13,8 @@ import XCTest import Combine @testable import ParseSwift +// swiftlint:disable type_body_length + class ParseHookTriggerCombineTests: XCTestCase { struct TestTrigger: ParseHookTriggerable { var className: String? diff --git a/Tests/ParseSwiftTests/ParseHookTriggerRequestCombineTests.swift b/Tests/ParseSwiftTests/ParseHookTriggerRequestCombineTests.swift index 21291a51c..67b965cc0 100644 --- a/Tests/ParseSwiftTests/ParseHookTriggerRequestCombineTests.swift +++ b/Tests/ParseSwiftTests/ParseHookTriggerRequestCombineTests.swift @@ -79,7 +79,7 @@ class ParseHookTriggerRequestCombineTests: XCTestCase { userOnServer.updatedAt = Date() var server = userOnServer let encoded = try ParseCoding.jsonEncoder().encode(server) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy server = try ParseCoding.jsonDecoder().decode(User.self, from: encoded) MockURLProtocol.mockRequests { _ in return MockURLResponse(data: encoded, statusCode: 200, delay: 0.0) diff --git a/Tests/ParseSwiftTests/ParseHookTriggerRequestTests.swift b/Tests/ParseSwiftTests/ParseHookTriggerRequestTests.swift index 96b9ee2d4..3346b2178 100644 --- a/Tests/ParseSwiftTests/ParseHookTriggerRequestTests.swift +++ b/Tests/ParseSwiftTests/ParseHookTriggerRequestTests.swift @@ -205,7 +205,7 @@ class ParseHookTriggerRequestTests: XCTestCase { userOnServer.updatedAt = Date() var server = userOnServer let encoded = try ParseCoding.jsonEncoder().encode(server) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy server = try ParseCoding.jsonDecoder().decode(User.self, from: encoded) MockURLProtocol.mockRequests { _ in return MockURLResponse(data: encoded, statusCode: 200, delay: 0.0) diff --git a/Tests/ParseSwiftTests/ParseHookTriggerTests.swift b/Tests/ParseSwiftTests/ParseHookTriggerTests.swift index becf5d475..5e47c9318 100644 --- a/Tests/ParseSwiftTests/ParseHookTriggerTests.swift +++ b/Tests/ParseSwiftTests/ParseHookTriggerTests.swift @@ -14,6 +14,8 @@ import FoundationNetworking import XCTest @testable import ParseSwift +// swiftlint:disable type_body_length + class ParseHookTriggerTests: XCTestCase { struct TestTrigger: ParseHookTriggerable { var className: String? diff --git a/Tests/ParseSwiftTests/ParseInstagramAsyncTests.swift b/Tests/ParseSwiftTests/ParseInstagramAsyncTests.swift index 2ba3f2f7f..25655e692 100644 --- a/Tests/ParseSwiftTests/ParseInstagramAsyncTests.swift +++ b/Tests/ParseSwiftTests/ParseInstagramAsyncTests.swift @@ -14,7 +14,7 @@ import FoundationNetworking import XCTest @testable import ParseSwift -class ParseInstagramAsyncTests: XCTestCase { // swiftlint:disable:this type_body_length +class ParseInstagramAsyncTests: XCTestCase { struct User: ParseUser { //: These are required by ParseObject @@ -103,7 +103,7 @@ class ParseInstagramAsyncTests: XCTestCase { // swiftlint:disable:this type_body let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -138,7 +138,7 @@ class ParseInstagramAsyncTests: XCTestCase { // swiftlint:disable:this type_body let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -185,7 +185,7 @@ class ParseInstagramAsyncTests: XCTestCase { // swiftlint:disable:this type_body let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -217,7 +217,7 @@ class ParseInstagramAsyncTests: XCTestCase { // swiftlint:disable:this type_body let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -258,7 +258,7 @@ class ParseInstagramAsyncTests: XCTestCase { // swiftlint:disable:this type_body let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") diff --git a/Tests/ParseSwiftTests/ParseInstagramCombineTests.swift b/Tests/ParseSwiftTests/ParseInstagramCombineTests.swift index 6f685c825..3e9a4eefe 100644 --- a/Tests/ParseSwiftTests/ParseInstagramCombineTests.swift +++ b/Tests/ParseSwiftTests/ParseInstagramCombineTests.swift @@ -105,7 +105,7 @@ class ParseInstagramCombineTests: XCTestCase { // swiftlint:disable:this type_bo let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -157,7 +157,7 @@ class ParseInstagramCombineTests: XCTestCase { // swiftlint:disable:this type_bo let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -219,7 +219,7 @@ class ParseInstagramCombineTests: XCTestCase { // swiftlint:disable:this type_bo let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -268,7 +268,7 @@ class ParseInstagramCombineTests: XCTestCase { // swiftlint:disable:this type_bo let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -326,7 +326,7 @@ class ParseInstagramCombineTests: XCTestCase { // swiftlint:disable:this type_bo let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") diff --git a/Tests/ParseSwiftTests/ParseInstagramTests.swift b/Tests/ParseSwiftTests/ParseInstagramTests.swift index 8cfabce18..e677a533c 100644 --- a/Tests/ParseSwiftTests/ParseInstagramTests.swift +++ b/Tests/ParseSwiftTests/ParseInstagramTests.swift @@ -13,6 +13,8 @@ import FoundationNetworking import XCTest @testable import ParseSwift +// swiftlint:disable type_body_length + class ParseInstagramTests: XCTestCase { struct User: ParseUser { @@ -148,7 +150,7 @@ class ParseInstagramTests: XCTestCase { let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -170,7 +172,7 @@ class ParseInstagramTests: XCTestCase { XCTAssertEqual(user.password, "world") XCTAssertTrue(user.instagram.isLinked) - //Test stripping + // Test stripping user.instagram.strip() XCTAssertFalse(user.instagram.isLinked) case .failure(let error): @@ -201,7 +203,7 @@ class ParseInstagramTests: XCTestCase { let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -223,7 +225,7 @@ class ParseInstagramTests: XCTestCase { XCTAssertEqual(user.password, "world") XCTAssertTrue(user.instagram.isLinked) - //Test stripping + // Test stripping user.instagram.strip() XCTAssertFalse(user.instagram.isLinked) case .failure(let error): @@ -270,7 +272,7 @@ class ParseInstagramTests: XCTestCase { let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -312,7 +314,7 @@ class ParseInstagramTests: XCTestCase { let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -353,7 +355,7 @@ class ParseInstagramTests: XCTestCase { let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -396,7 +398,7 @@ class ParseInstagramTests: XCTestCase { let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -440,7 +442,7 @@ class ParseInstagramTests: XCTestCase { let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -513,7 +515,7 @@ class ParseInstagramTests: XCTestCase { let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") diff --git a/Tests/ParseSwiftTests/ParseInstallationAsyncTests.swift b/Tests/ParseSwiftTests/ParseInstallationAsyncTests.swift index e40bc4084..95d85f482 100644 --- a/Tests/ParseSwiftTests/ParseInstallationAsyncTests.swift +++ b/Tests/ParseSwiftTests/ParseInstallationAsyncTests.swift @@ -14,6 +14,8 @@ import FoundationNetworking import XCTest @testable import ParseSwift +// swiftlint:disable function_body_length + class ParseInstallationAsyncTests: XCTestCase { // swiftlint:disable:this type_body_length struct User: ParseUser { @@ -197,7 +199,7 @@ class ParseInstallationAsyncTests: XCTestCase { // swiftlint:disable:this type_b let encoded: Data! do { encoded = try installationOnServer.getEncoder().encode(installationOnServer, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy installationOnServer = try installationOnServer.getDecoder().decode(Installation.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -341,7 +343,7 @@ class ParseInstallationAsyncTests: XCTestCase { // swiftlint:disable:this type_b MockURLProtocol.mockRequests { _ in do { let encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy serverResponse = try serverResponse.getDecoder().decode(Installation.self, from: encoded) return MockURLResponse(data: encoded, statusCode: 200, delay: 0.0) } catch { @@ -372,7 +374,7 @@ class ParseInstallationAsyncTests: XCTestCase { // swiftlint:disable:this type_b MockURLProtocol.mockRequests { _ in do { let encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy serverResponse = try serverResponse.getDecoder().decode(Installation.self, from: encoded) return MockURLResponse(data: encoded, statusCode: 200, delay: 0.0) } catch { @@ -403,7 +405,7 @@ class ParseInstallationAsyncTests: XCTestCase { // swiftlint:disable:this type_b MockURLProtocol.mockRequests { _ in do { let encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy serverResponse = try serverResponse.getDecoder().decode(Installation.self, from: encoded) return MockURLResponse(data: encoded, statusCode: 200, delay: 0.0) } catch { @@ -434,7 +436,7 @@ class ParseInstallationAsyncTests: XCTestCase { // swiftlint:disable:this type_b MockURLProtocol.mockRequests { _ in do { let encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy serverResponse = try serverResponse.getDecoder().decode(Installation.self, from: encoded) return MockURLResponse(data: encoded, statusCode: 200, delay: 0.0) } catch { @@ -523,7 +525,7 @@ class ParseInstallationAsyncTests: XCTestCase { // swiftlint:disable:this type_b let encoded: Data! do { encoded = try originalResponse.getEncoder().encode(originalResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy originalResponse = try originalResponse.getDecoder().decode(Installation.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -603,7 +605,7 @@ class ParseInstallationAsyncTests: XCTestCase { // swiftlint:disable:this type_b let encoded: Data! do { encoded = try originalResponse.getEncoder().encode(originalResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy originalResponse = try originalResponse.getDecoder().decode(InstallationDefault.self, from: encoded) } catch { @@ -768,7 +770,7 @@ class ParseInstallationAsyncTests: XCTestCase { // swiftlint:disable:this type_b let encoded: Data! do { encoded = try ParseCoding.jsonEncoder().encode(installationOnServer) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy let encoded1 = try ParseCoding.jsonEncoder().encode(installation) installation = try installation.getDecoder().decode(Installation.self, from: encoded1) } catch { @@ -800,7 +802,7 @@ class ParseInstallationAsyncTests: XCTestCase { // swiftlint:disable:this type_b XCTAssertEqual(fetchedUpdatedAt, serverUpdatedAt) XCTAssertEqual(Installation.current?.customKey, installation.customKey) - //Should be updated in memory + // Should be updated in memory guard let updatedCurrentDate = Installation.current?.updatedAt else { XCTFail("Should unwrap current date") return @@ -808,7 +810,7 @@ class ParseInstallationAsyncTests: XCTestCase { // swiftlint:disable:this type_b XCTAssertEqual(updatedCurrentDate, serverUpdatedAt) #if !os(Linux) && !os(Android) && !os(Windows) - //Should be updated in Keychain + // Should be updated in Keychain guard let keychainInstallation: CurrentInstallationContainer = try? KeychainStore.shared.get(valueFor: ParseStorage.Keys.currentInstallation), let keychainUpdatedCurrentDate = keychainInstallation.currentInstallation?.updatedAt else { @@ -840,7 +842,7 @@ class ParseInstallationAsyncTests: XCTestCase { // swiftlint:disable:this type_b let encoded: Data! do { encoded = try ParseCoding.jsonEncoder().encode(installationOnServer) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy let encoded1 = try ParseCoding.jsonEncoder().encode(installation) installation = try installation.getDecoder().decode(Installation.self, from: encoded1) } catch { @@ -868,7 +870,7 @@ class ParseInstallationAsyncTests: XCTestCase { // swiftlint:disable:this type_b XCTAssertEqual(savedUpdatedAt, originalUpdatedAt) XCTAssertEqual(Installation.current?.customKey, installation.customKey) - //Should be updated in memory + // Should be updated in memory guard let updatedCurrentDate = Installation.current?.updatedAt else { XCTFail("Should unwrap current date") return @@ -876,7 +878,7 @@ class ParseInstallationAsyncTests: XCTestCase { // swiftlint:disable:this type_b XCTAssertEqual(updatedCurrentDate, originalUpdatedAt) #if !os(Linux) && !os(Android) && !os(Windows) - //Should be updated in Keychain + // Should be updated in Keychain guard let keychainInstallation: CurrentInstallationContainer = try? KeychainStore.shared.get(valueFor: ParseStorage.Keys.currentInstallation), let keychainUpdatedCurrentDate = keychainInstallation.currentInstallation?.updatedAt else { @@ -908,7 +910,7 @@ class ParseInstallationAsyncTests: XCTestCase { // swiftlint:disable:this type_b let encoded: Data! do { encoded = try ParseCoding.jsonEncoder().encode(installationOnServer) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy let encoded1 = try ParseCoding.jsonEncoder().encode(serverResponse) serverResponse = try installation.getDecoder().decode(Installation.self, from: encoded1) } catch { @@ -960,7 +962,7 @@ class ParseInstallationAsyncTests: XCTestCase { // swiftlint:disable:this type_b let encoded: Data! do { encoded = try ParseCoding.jsonEncoder().encode(installationOnServer) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy let encoded1 = try ParseCoding.jsonEncoder().encode(serverResponse) serverResponse = try installation.getDecoder().decode(Installation.self, from: encoded1) } catch { @@ -1003,7 +1005,7 @@ class ParseInstallationAsyncTests: XCTestCase { // swiftlint:disable:this type_b let encoded: Data! do { encoded = try ParseCoding.jsonEncoder().encode(installationOnServer) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy let encoded1 = try ParseCoding.jsonEncoder().encode(serverResponse) serverResponse = try installation.getDecoder().decode(Installation.self, from: encoded1) } catch { @@ -1053,7 +1055,7 @@ class ParseInstallationAsyncTests: XCTestCase { // swiftlint:disable:this type_b let encoded: Data! do { encoded = try ParseCoding.jsonEncoder().encode(installationOnServer) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy let encoded1 = try ParseCoding.jsonEncoder().encode(serverResponse) serverResponse = try installation.getDecoder().decode(Installation.self, from: encoded1) } catch { diff --git a/Tests/ParseSwiftTests/ParseInstallationCombineTests.swift b/Tests/ParseSwiftTests/ParseInstallationCombineTests.swift index 7adb10f98..94f166c10 100644 --- a/Tests/ParseSwiftTests/ParseInstallationCombineTests.swift +++ b/Tests/ParseSwiftTests/ParseInstallationCombineTests.swift @@ -13,6 +13,8 @@ import XCTest import Combine @testable import ParseSwift +// swiftlint:disable function_body_length + class ParseInstallationCombineTests: XCTestCase { // swiftlint:disable:this type_body_length struct User: ParseUser { @@ -147,7 +149,7 @@ class ParseInstallationCombineTests: XCTestCase { // swiftlint:disable:this type let encoded: Data! do { encoded = try installationOnServer.getEncoder().encode(installationOnServer, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy installationOnServer = try installationOnServer.getDecoder().decode(Installation.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -281,7 +283,7 @@ class ParseInstallationCombineTests: XCTestCase { // swiftlint:disable:this type MockURLProtocol.mockRequests { _ in do { let encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy serverResponse = try serverResponse.getDecoder().decode(Installation.self, from: encoded) return MockURLResponse(data: encoded, statusCode: 200, delay: 0.0) } catch { @@ -327,7 +329,7 @@ class ParseInstallationCombineTests: XCTestCase { // swiftlint:disable:this type MockURLProtocol.mockRequests { _ in do { let encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy serverResponse = try serverResponse.getDecoder().decode(Installation.self, from: encoded) return MockURLResponse(data: encoded, statusCode: 200, delay: 0.0) } catch { @@ -418,7 +420,7 @@ class ParseInstallationCombineTests: XCTestCase { // swiftlint:disable:this type let encoded: Data! do { encoded = try ParseCoding.jsonEncoder().encode(installationOnServer) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy let encoded1 = try ParseCoding.jsonEncoder().encode(installation) installation = try installation.getDecoder().decode(Installation.self, from: encoded1) } catch { @@ -462,7 +464,7 @@ class ParseInstallationCombineTests: XCTestCase { // swiftlint:disable:this type XCTAssertEqual(fetchedUpdatedAt, serverUpdatedAt) XCTAssertEqual(Installation.current?.customKey, installation.customKey) - //Should be updated in memory + // Should be updated in memory guard let updatedCurrentDate = Installation.current?.updatedAt else { XCTFail("Should unwrap current date") expectation1.fulfill() @@ -471,7 +473,7 @@ class ParseInstallationCombineTests: XCTestCase { // swiftlint:disable:this type XCTAssertEqual(updatedCurrentDate, serverUpdatedAt) #if !os(Linux) && !os(Android) && !os(Windows) - //Should be updated in Keychain + // Should be updated in Keychain guard let keychainInstallation: CurrentInstallationContainer = try? KeychainStore.shared.get(valueFor: ParseStorage.Keys.currentInstallation), let keychainUpdatedCurrentDate = keychainInstallation.currentInstallation?.updatedAt else { @@ -509,7 +511,7 @@ class ParseInstallationCombineTests: XCTestCase { // swiftlint:disable:this type let encoded: Data! do { encoded = try ParseCoding.jsonEncoder().encode(installationOnServer) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy let encoded1 = try ParseCoding.jsonEncoder().encode(installation) installation = try installation.getDecoder().decode(Installation.self, from: encoded1) } catch { @@ -549,7 +551,7 @@ class ParseInstallationCombineTests: XCTestCase { // swiftlint:disable:this type XCTAssertEqual(savedUpdatedAt, originalUpdatedAt) XCTAssertEqual(Installation.current?.customKey, installation.customKey) - //Should be updated in memory + // Should be updated in memory guard let updatedCurrentDate = Installation.current?.updatedAt else { XCTFail("Should unwrap current date") expectation1.fulfill() @@ -558,7 +560,7 @@ class ParseInstallationCombineTests: XCTestCase { // swiftlint:disable:this type XCTAssertEqual(updatedCurrentDate, originalUpdatedAt) #if !os(Linux) && !os(Android) && !os(Windows) - //Should be updated in Keychain + // Should be updated in Keychain guard let keychainInstallation: CurrentInstallationContainer = try? KeychainStore.shared.get(valueFor: ParseStorage.Keys.currentInstallation), let keychainUpdatedCurrentDate = keychainInstallation.currentInstallation?.updatedAt else { @@ -595,7 +597,7 @@ class ParseInstallationCombineTests: XCTestCase { // swiftlint:disable:this type let encoded: Data! do { encoded = try ParseCoding.jsonEncoder().encode(installationOnServer) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy let encoded1 = try ParseCoding.jsonEncoder().encode(serverResponse) serverResponse = try installation.getDecoder().decode(Installation.self, from: encoded1) } catch { @@ -663,7 +665,7 @@ class ParseInstallationCombineTests: XCTestCase { // swiftlint:disable:this type let encoded: Data! do { encoded = try ParseCoding.jsonEncoder().encode(installationOnServer) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy let encoded1 = try ParseCoding.jsonEncoder().encode(serverResponse) serverResponse = try installation.getDecoder().decode(Installation.self, from: encoded1) } catch { @@ -720,7 +722,7 @@ class ParseInstallationCombineTests: XCTestCase { // swiftlint:disable:this type let encoded: Data! do { encoded = try ParseCoding.jsonEncoder().encode(installationOnServer) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy let encoded1 = try ParseCoding.jsonEncoder().encode(serverResponse) serverResponse = try installation.getDecoder().decode(Installation.self, from: encoded1) } catch { @@ -786,7 +788,7 @@ class ParseInstallationCombineTests: XCTestCase { // swiftlint:disable:this type let encoded: Data! do { encoded = try ParseCoding.jsonEncoder().encode(installationOnServer) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy let encoded1 = try ParseCoding.jsonEncoder().encode(serverResponse) serverResponse = try installation.getDecoder().decode(Installation.self, from: encoded1) } catch { diff --git a/Tests/ParseSwiftTests/ParseInstallationTests.swift b/Tests/ParseSwiftTests/ParseInstallationTests.swift index 70254ac87..bf6d3d6d9 100644 --- a/Tests/ParseSwiftTests/ParseInstallationTests.swift +++ b/Tests/ParseSwiftTests/ParseInstallationTests.swift @@ -10,6 +10,8 @@ import Foundation import XCTest @testable import ParseSwift +// swiftlint:disable file_length + class ParseInstallationTests: XCTestCase { // swiftlint:disable:this type_body_length struct User: ParseUser { @@ -240,7 +242,6 @@ class ParseInstallationTests: XCTestCase { // swiftlint:disable:this type_body_l XCTAssertEqual(keychainInstallation.currentInstallation?.customKey, customField) } - // swiftlint:disable:next function_body_length func testInstallationImmutableFieldsCannotBeChangedInKeychain() { guard let originalInstallation = Installation.current, let originalInstallationId = originalInstallation.installationId, @@ -457,7 +458,7 @@ class ParseInstallationTests: XCTestCase { // swiftlint:disable:this type_body_l let encoded: Data! do { encoded = try installationOnServer.getEncoder().encode(installationOnServer, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy installationOnServer = try installationOnServer.getDecoder().decode(Installation.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -500,7 +501,7 @@ class ParseInstallationTests: XCTestCase { // swiftlint:disable:this type_body_l let encoded: Data! do { encoded = try installationOnServer.getEncoder().encode(installationOnServer, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy installationOnServer = try installationOnServer.getDecoder().decode(Installation.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -526,6 +527,7 @@ class ParseInstallationTests: XCTestCase { // swiftlint:disable:this type_body_l } } + // swiftlint:disable:next function_body_length func testSaveMutableMergeCurrentInstallation() throws { // Save current Installation try testSaveCurrentInstallation() @@ -542,7 +544,7 @@ class ParseInstallationTests: XCTestCase { // swiftlint:disable:this type_body_l let encoded: Data! do { encoded = try response.getEncoder().encode(response, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy response = try response.getDecoder().decode(Installation.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -626,7 +628,7 @@ class ParseInstallationTests: XCTestCase { // swiftlint:disable:this type_body_l let encoded: Data! do { encoded = try installationOnServer.getEncoder().encode(installationOnServer, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy installationOnServer = try installationOnServer.getDecoder().decode(Installation.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -656,7 +658,6 @@ class ParseInstallationTests: XCTestCase { // swiftlint:disable:this type_body_l } } - // swiftlint:disable:next function_body_length func updateAsync(installation: Installation, installationOnServer: Installation, callbackQueue: DispatchQueue) { let expectation1 = XCTestExpectation(description: "Update installation1") @@ -705,11 +706,11 @@ class ParseInstallationTests: XCTestCase { // swiftlint:disable:this type_body_l let encoded: Data! do { let encodedOriginal = try ParseCoding.jsonEncoder().encode(installation) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy installation = try installation.getDecoder().decode(Installation.self, from: encodedOriginal) encoded = try installationOnServer.getEncoder().encode(installationOnServer, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy installationOnServer = try installationOnServer.getDecoder().decode(Installation.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -722,7 +723,6 @@ class ParseInstallationTests: XCTestCase { // swiftlint:disable:this type_body_l self.updateAsync(installation: installation, installationOnServer: installationOnServer, callbackQueue: .main) } - // swiftlint:disable:next function_body_length func saveCurrentAsync(installation: Installation, installationOnServer: Installation, callbackQueue: DispatchQueue) { @@ -779,11 +779,11 @@ class ParseInstallationTests: XCTestCase { // swiftlint:disable:this type_body_l let encoded: Data! do { let encodedOriginal = try ParseCoding.jsonEncoder().encode(installation) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy installation = try installation.getDecoder().decode(Installation.self, from: encodedOriginal) encoded = try installationOnServer.getEncoder().encode(installationOnServer, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy installationOnServer = try installationOnServer.getDecoder().decode(Installation.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -862,7 +862,7 @@ class ParseInstallationTests: XCTestCase { // swiftlint:disable:this type_body_l let encoded: Data! do { encoded = try installationOnServer.getEncoder().encode(installationOnServer, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy installationOnServer = try installationOnServer.getDecoder().decode(Installation.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -898,14 +898,14 @@ class ParseInstallationTests: XCTestCase { // swiftlint:disable:this type_body_l XCTAssertEqual(fetchedUpdatedAt, serverUpdatedAt) XCTAssertEqual(Installation.current?.customKey, installationOnServer.customKey) - //Should be updated in memory + // Should be updated in memory guard let updatedCurrentDate = Installation.current?.updatedAt else { XCTFail("Should unwrap current date") return } XCTAssertEqual(updatedCurrentDate, serverUpdatedAt) - //Should be updated in Keychain + // Should be updated in Keychain #if !os(Linux) && !os(Android) && !os(Windows) guard let keychainInstallation: CurrentInstallationContainer = try? KeychainStore.shared.get(valueFor: ParseStorage.Keys.currentInstallation), @@ -939,7 +939,7 @@ class ParseInstallationTests: XCTestCase { // swiftlint:disable:this type_body_l let encoded: Data! do { encoded = try installationOnServer.getEncoder().encode(installationOnServer, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy installationOnServer = try installationOnServer.getDecoder().decode(Installation.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -980,7 +980,7 @@ class ParseInstallationTests: XCTestCase { // swiftlint:disable:this type_body_l XCTAssertEqual(fetchedUpdatedAt, serverUpdatedAt) XCTAssertEqual(Installation.current?.customKey, installationOnServer.customKey) - //Should be updated in memory + // Should be updated in memory guard let updatedCurrentDate = Installation.current?.updatedAt else { XCTFail("Should unwrap current date") expectation1.fulfill() @@ -989,7 +989,7 @@ class ParseInstallationTests: XCTestCase { // swiftlint:disable:this type_body_l XCTAssertEqual(updatedCurrentDate, serverUpdatedAt) #if !os(Linux) && !os(Android) && !os(Windows) - //Should be updated in Keychain + // Should be updated in Keychain guard let keychainInstallation: CurrentInstallationContainer = try? KeychainStore.shared.get(valueFor: ParseStorage.Keys.currentInstallation), let keychainUpdatedCurrentDate = keychainInstallation.currentInstallation?.updatedAt else { @@ -1066,7 +1066,7 @@ class ParseInstallationTests: XCTestCase { // swiftlint:disable:this type_body_l let encoded: Data! do { encoded = try installationOnServer.getEncoder().encode(installationOnServer, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy installationOnServer = try installationOnServer.getDecoder().decode(Installation.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -1106,7 +1106,7 @@ class ParseInstallationTests: XCTestCase { // swiftlint:disable:this type_body_l let encoded: Data! do { encoded = try ParseCoding.jsonEncoder().encode(installationOnServer) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy let encoded1 = try ParseCoding.jsonEncoder().encode(installation) installation = try installation.getDecoder().decode(Installation.self, from: encoded1) } catch { @@ -1144,7 +1144,7 @@ class ParseInstallationTests: XCTestCase { // swiftlint:disable:this type_body_l XCTAssertEqual(fetchedUpdatedAt, serverUpdatedAt) XCTAssertEqual(Installation.current?.customKey, installation.customKey) - //Should be updated in memory + // Should be updated in memory guard let updatedCurrentDate = Installation.current?.updatedAt else { XCTFail("Should unwrap current date") return @@ -1152,7 +1152,7 @@ class ParseInstallationTests: XCTestCase { // swiftlint:disable:this type_body_l XCTAssertEqual(updatedCurrentDate, serverUpdatedAt) #if !os(Linux) && !os(Android) && !os(Windows) - //Should be updated in Keychain + // Should be updated in Keychain guard let keychainInstallation: CurrentInstallationContainer = try? KeychainStore.shared.get(valueFor: ParseStorage.Keys.currentInstallation), let keychainUpdatedCurrentDate = keychainInstallation.currentInstallation?.updatedAt else { @@ -1170,7 +1170,7 @@ class ParseInstallationTests: XCTestCase { // swiftlint:disable:this type_body_l } } - // swiftlint:disable:next function_body_length + // swiftlint:disable:next function_body_length cyclomatic_complexity func testFetchAllAsyncMainQueueCurrent() throws { try testSaveCurrentInstallation() MockURLProtocol.removeAll() @@ -1189,7 +1189,7 @@ class ParseInstallationTests: XCTestCase { // swiftlint:disable:this type_body_l let encoded: Data! do { encoded = try ParseCoding.jsonEncoder().encode(installationOnServer) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy let encoded1 = try ParseCoding.jsonEncoder().encode(installation) installation = try installation.getDecoder().decode(Installation.self, from: encoded1) } catch { @@ -1232,7 +1232,7 @@ class ParseInstallationTests: XCTestCase { // swiftlint:disable:this type_body_l XCTAssertEqual(fetchedUpdatedAt, serverUpdatedAt) XCTAssertEqual(Installation.current?.customKey, installation.customKey) - //Should be updated in memory + // Should be updated in memory guard let updatedCurrentDate = Installation.current?.updatedAt else { XCTFail("Should unwrap current date") expectation1.fulfill() @@ -1241,7 +1241,7 @@ class ParseInstallationTests: XCTestCase { // swiftlint:disable:this type_body_l XCTAssertEqual(updatedCurrentDate, serverUpdatedAt) #if !os(Linux) && !os(Android) && !os(Windows) - //Should be updated in Keychain + // Should be updated in Keychain guard let keychainInstallation: CurrentInstallationContainer = try? KeychainStore.shared.get(valueFor: ParseStorage.Keys.currentInstallation), let keychainUpdatedCurrentDate = keychainInstallation @@ -1327,7 +1327,7 @@ class ParseInstallationTests: XCTestCase { // swiftlint:disable:this type_body_l XCTAssertNotNil(command.body) } - // swiftlint:disable:next function_body_length + // swiftlint:disable:next function_body_length cyclomatic_complexity func testSaveAllCurrent() throws { try testSaveCurrentInstallation() MockURLProtocol.removeAll() @@ -1350,7 +1350,7 @@ class ParseInstallationTests: XCTestCase { // swiftlint:disable:this type_body_l let encoded: Data! do { encoded = try ParseCoding.jsonEncoder().encode(installationOnServer) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy let encoded1 = try ParseCoding.jsonEncoder().encode(installation) installation = try installation.getDecoder().decode(Installation.self, from: encoded1) let encoded2 = try ParseCoding.jsonEncoder().encode(installation2) @@ -1383,7 +1383,7 @@ class ParseInstallationTests: XCTestCase { // swiftlint:disable:this type_body_l XCTAssertEqual(savedUpdatedAt, installation.updatedAt) XCTAssertEqual(Installation.current?.customKey, installation.customKey) - //Should be updated in memory + // Should be updated in memory guard let updatedCurrentDate = Installation.current?.updatedAt else { XCTFail("Should unwrap current date") return @@ -1391,7 +1391,7 @@ class ParseInstallationTests: XCTestCase { // swiftlint:disable:this type_body_l XCTAssertEqual(updatedCurrentDate, installation.updatedAt) #if !os(Linux) && !os(Android) && !os(Windows) - //Should be updated in Keychain + // Should be updated in Keychain guard let keychainInstallation: CurrentInstallationContainer = try? KeychainStore.shared.get(valueFor: ParseStorage.Keys.currentInstallation), let keychainUpdatedCurrentDate = keychainInstallation.currentInstallation?.updatedAt else { @@ -1426,7 +1426,7 @@ class ParseInstallationTests: XCTestCase { // swiftlint:disable:this type_body_l XCTAssertEqual(savedUpdatedAt, installation.updatedAt) XCTAssertEqual(Installation.current?.customKey, installation.customKey) - //Should be updated in memory + // Should be updated in memory guard let updatedCurrentDate = Installation.current?.updatedAt else { XCTFail("Should unwrap current date") return @@ -1434,7 +1434,7 @@ class ParseInstallationTests: XCTestCase { // swiftlint:disable:this type_body_l XCTAssertEqual(updatedCurrentDate, installation.updatedAt) #if !os(Linux) && !os(Android) && !os(Windows) - //Should be updated in Keychain + // Should be updated in Keychain guard let keychainInstallation: CurrentInstallationContainer = try? KeychainStore.shared.get(valueFor: ParseStorage.Keys.currentInstallation), let keychainUpdatedCurrentDate = keychainInstallation.currentInstallation?.updatedAt else { @@ -1452,7 +1452,7 @@ class ParseInstallationTests: XCTestCase { // swiftlint:disable:this type_body_l } } - // swiftlint:disable:next function_body_length + // swiftlint:disable:next function_body_length cyclomatic_complexity func testSaveAllAsyncMainQueueCurrent() throws { try testSaveCurrentInstallation() MockURLProtocol.removeAll() @@ -1478,7 +1478,7 @@ class ParseInstallationTests: XCTestCase { // swiftlint:disable:this type_body_l let encoded: Data! do { encoded = try ParseCoding.jsonEncoder().encode(installationOnServer) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy let encoded1 = try ParseCoding.jsonEncoder().encode(installation) installation = try installation.getDecoder().decode(Installation.self, from: encoded1) } catch { @@ -1514,7 +1514,7 @@ class ParseInstallationTests: XCTestCase { // swiftlint:disable:this type_body_l XCTAssertEqual(savedUpdatedAt, installation.updatedAt) XCTAssertEqual(Installation.current?.customKey, installation.customKey) - //Should be updated in memory + // Should be updated in memory guard let updatedCurrentDate = Installation.current?.updatedAt else { XCTFail("Should unwrap current date") expectation1.fulfill() @@ -1522,7 +1522,7 @@ class ParseInstallationTests: XCTestCase { // swiftlint:disable:this type_body_l } XCTAssertEqual(updatedCurrentDate, installation.updatedAt) #if !os(Linux) && !os(Android) && !os(Windows) - //Should be updated in Keychain + // Should be updated in Keychain guard let keychainInstallation: CurrentInstallationContainer = try? KeychainStore.shared.get(valueFor: ParseStorage.Keys.currentInstallation), let keychainUpdatedCurrentDate = keychainInstallation @@ -1565,7 +1565,7 @@ class ParseInstallationTests: XCTestCase { // swiftlint:disable:this type_body_l XCTAssertEqual(savedUpdatedAt, installation.updatedAt) XCTAssertEqual(Installation.current?.customKey, installation.customKey) - //Should be updated in memory + // Should be updated in memory guard let updatedCurrentDate = Installation.current?.updatedAt else { XCTFail("Should unwrap current date") expectation2.fulfill() @@ -1573,7 +1573,7 @@ class ParseInstallationTests: XCTestCase { // swiftlint:disable:this type_body_l } XCTAssertEqual(updatedCurrentDate, installation.updatedAt) #if !os(Linux) && !os(Android) && !os(Windows) - //Should be updated in Keychain + // Should be updated in Keychain guard let keychainInstallation: CurrentInstallationContainer = try? KeychainStore.shared.get(valueFor: ParseStorage.Keys.currentInstallation), let keychainUpdatedCurrentDate = keychainInstallation @@ -1644,6 +1644,7 @@ class ParseInstallationTests: XCTestCase { // swiftlint:disable:this type_body_l } } + // swiftlint:disable:next function_body_length func testDeleteAllAsyncMainQueueCurrent() throws { try testSaveCurrentInstallation() MockURLProtocol.removeAll() @@ -1709,4 +1710,3 @@ class ParseInstallationTests: XCTestCase { // swiftlint:disable:this type_body_l wait(for: [expectation1, expectation2], timeout: 20.0) } } -// swiftlint:disable:this file_length diff --git a/Tests/ParseSwiftTests/ParseKeychainAccessGroupTests.swift b/Tests/ParseSwiftTests/ParseKeychainAccessGroupTests.swift index e75480bbb..bebaaf632 100644 --- a/Tests/ParseSwiftTests/ParseKeychainAccessGroupTests.swift +++ b/Tests/ParseSwiftTests/ParseKeychainAccessGroupTests.swift @@ -11,6 +11,8 @@ import Foundation import XCTest @testable import ParseSwift +// swiftlint:disable unused_optional_binding function_body_length type_body_length + class ParseKeychainAccessGroupTests: XCTestCase { struct User: ParseUser { @@ -185,6 +187,7 @@ class ParseKeychainAccessGroupTests: XCTestCase { XCTAssertEqual(ParseSwift.configuration.keychainAccessGroup, keychainAccessGroup) } + // swiftlint:disable:next cyclomatic_complexity func testCanCopyEntireKeychain() throws { try userLogin() Config.current = .init(welcomeMessage: "yolo", winningNumber: 1) @@ -261,6 +264,7 @@ class ParseKeychainAccessGroupTests: XCTestCase { XCTAssertEqual(acl, otherAcl) } + // swiftlint:disable:next cyclomatic_complexity func testRemoveOldObjectsFromKeychain() throws { try userLogin() Config.current = .init(welcomeMessage: "yolo", winningNumber: 1) diff --git a/Tests/ParseSwiftTests/ParseLDAPAsyncTests.swift b/Tests/ParseSwiftTests/ParseLDAPAsyncTests.swift index 68daa85b3..73f4fa2b1 100644 --- a/Tests/ParseSwiftTests/ParseLDAPAsyncTests.swift +++ b/Tests/ParseSwiftTests/ParseLDAPAsyncTests.swift @@ -14,7 +14,7 @@ import FoundationNetworking import XCTest @testable import ParseSwift -class ParseLDAPAsyncTests: XCTestCase { // swiftlint:disable:this type_body_length +class ParseLDAPAsyncTests: XCTestCase { struct User: ParseUser { //: These are required by ParseObject @@ -104,7 +104,7 @@ class ParseLDAPAsyncTests: XCTestCase { // swiftlint:disable:this type_body_leng let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -140,7 +140,7 @@ class ParseLDAPAsyncTests: XCTestCase { // swiftlint:disable:this type_body_leng let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -187,7 +187,7 @@ class ParseLDAPAsyncTests: XCTestCase { // swiftlint:disable:this type_body_leng let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -220,7 +220,7 @@ class ParseLDAPAsyncTests: XCTestCase { // swiftlint:disable:this type_body_leng let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -261,7 +261,7 @@ class ParseLDAPAsyncTests: XCTestCase { // swiftlint:disable:this type_body_leng let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") diff --git a/Tests/ParseSwiftTests/ParseLDAPCombineTests.swift b/Tests/ParseSwiftTests/ParseLDAPCombineTests.swift index 4b9700cf4..33465eed1 100644 --- a/Tests/ParseSwiftTests/ParseLDAPCombineTests.swift +++ b/Tests/ParseSwiftTests/ParseLDAPCombineTests.swift @@ -105,7 +105,7 @@ class ParseLDAPCombineTests: XCTestCase { // swiftlint:disable:this type_body_le let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -155,7 +155,7 @@ class ParseLDAPCombineTests: XCTestCase { // swiftlint:disable:this type_body_le let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -216,7 +216,7 @@ class ParseLDAPCombineTests: XCTestCase { // swiftlint:disable:this type_body_le let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -263,7 +263,7 @@ class ParseLDAPCombineTests: XCTestCase { // swiftlint:disable:this type_body_le let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -318,7 +318,7 @@ class ParseLDAPCombineTests: XCTestCase { // swiftlint:disable:this type_body_le let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") diff --git a/Tests/ParseSwiftTests/ParseLDAPTests.swift b/Tests/ParseSwiftTests/ParseLDAPTests.swift index 23540e5d8..929fd3e39 100644 --- a/Tests/ParseSwiftTests/ParseLDAPTests.swift +++ b/Tests/ParseSwiftTests/ParseLDAPTests.swift @@ -10,6 +10,8 @@ import Foundation import XCTest @testable import ParseSwift +// swiftlint:disable type_body_length + class ParseLDAPTests: XCTestCase { struct User: ParseUser { @@ -131,7 +133,7 @@ class ParseLDAPTests: XCTestCase { let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -153,7 +155,7 @@ class ParseLDAPTests: XCTestCase { XCTAssertEqual(user.password, "world") XCTAssertTrue(user.ldap.isLinked) - //Test stripping + // Test stripping user.ldap.strip() XCTAssertFalse(user.ldap.isLinked) case .failure(let error): @@ -200,7 +202,7 @@ class ParseLDAPTests: XCTestCase { let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -240,7 +242,7 @@ class ParseLDAPTests: XCTestCase { let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -281,7 +283,7 @@ class ParseLDAPTests: XCTestCase { let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -324,7 +326,7 @@ class ParseLDAPTests: XCTestCase { let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -368,7 +370,7 @@ class ParseLDAPTests: XCTestCase { let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -435,7 +437,7 @@ class ParseLDAPTests: XCTestCase { let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") diff --git a/Tests/ParseSwiftTests/ParseLinkedInCombineTests.swift b/Tests/ParseSwiftTests/ParseLinkedInCombineTests.swift index c9dbeccf2..95aaf00e4 100644 --- a/Tests/ParseSwiftTests/ParseLinkedInCombineTests.swift +++ b/Tests/ParseSwiftTests/ParseLinkedInCombineTests.swift @@ -105,7 +105,7 @@ class ParseLinkedInCombineTests: XCTestCase { // swiftlint:disable:this type_bod let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -157,7 +157,7 @@ class ParseLinkedInCombineTests: XCTestCase { // swiftlint:disable:this type_bod let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -219,7 +219,7 @@ class ParseLinkedInCombineTests: XCTestCase { // swiftlint:disable:this type_bod let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -268,7 +268,7 @@ class ParseLinkedInCombineTests: XCTestCase { // swiftlint:disable:this type_bod let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -326,7 +326,7 @@ class ParseLinkedInCombineTests: XCTestCase { // swiftlint:disable:this type_bod let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") diff --git a/Tests/ParseSwiftTests/ParseLinkedInTests.swift b/Tests/ParseSwiftTests/ParseLinkedInTests.swift index 8d5d2c287..9aab09fd9 100644 --- a/Tests/ParseSwiftTests/ParseLinkedInTests.swift +++ b/Tests/ParseSwiftTests/ParseLinkedInTests.swift @@ -116,7 +116,7 @@ class ParseLinkedInTests: XCTestCase { // swiftlint:disable:this type_body_lengt let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -172,7 +172,7 @@ class ParseLinkedInTests: XCTestCase { // swiftlint:disable:this type_body_lengt let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -210,7 +210,7 @@ class ParseLinkedInTests: XCTestCase { // swiftlint:disable:this type_body_lengt let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -257,7 +257,7 @@ class ParseLinkedInTests: XCTestCase { // swiftlint:disable:this type_body_lengt let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -291,7 +291,7 @@ class ParseLinkedInTests: XCTestCase { // swiftlint:disable:this type_body_lengt let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -326,7 +326,7 @@ class ParseLinkedInTests: XCTestCase { // swiftlint:disable:this type_body_lengt let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -362,7 +362,7 @@ class ParseLinkedInTests: XCTestCase { // swiftlint:disable:this type_body_lengt let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -422,7 +422,7 @@ class ParseLinkedInTests: XCTestCase { // swiftlint:disable:this type_body_lengt let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") diff --git a/Tests/ParseSwiftTests/ParseLiveQueryAsyncTests.swift b/Tests/ParseSwiftTests/ParseLiveQueryAsyncTests.swift index b40a40195..129a143fd 100644 --- a/Tests/ParseSwiftTests/ParseLiveQueryAsyncTests.swift +++ b/Tests/ParseSwiftTests/ParseLiveQueryAsyncTests.swift @@ -14,7 +14,7 @@ import FoundationNetworking import XCTest @testable import ParseSwift -class ParseLiveQueryAsyncTests: XCTestCase { // swiftlint:disable:this type_body_length +class ParseLiveQueryAsyncTests: XCTestCase { override func setUpWithError() throws { try super.setUpWithError() guard let url = URL(string: "http://localhost:1337/1") else { diff --git a/Tests/ParseSwiftTests/ParseLiveQueryCombineTests.swift b/Tests/ParseSwiftTests/ParseLiveQueryCombineTests.swift index 9776a3f69..0be69bc49 100644 --- a/Tests/ParseSwiftTests/ParseLiveQueryCombineTests.swift +++ b/Tests/ParseSwiftTests/ParseLiveQueryCombineTests.swift @@ -57,7 +57,7 @@ class ParseLiveQueryCombineTests: XCTestCase { case .finished: XCTFail("Should have produced failure") case .failure(let error): - XCTAssertNotNil(error) //Should always fail since WS is not intercepted. + XCTAssertNotNil(error) // Should always fail since WS is not intercepted. } expectation1.fulfill() diff --git a/Tests/ParseSwiftTests/ParseLiveQueryTests.swift b/Tests/ParseSwiftTests/ParseLiveQueryTests.swift index 5c417f547..322ceb4d2 100644 --- a/Tests/ParseSwiftTests/ParseLiveQueryTests.swift +++ b/Tests/ParseSwiftTests/ParseLiveQueryTests.swift @@ -10,6 +10,8 @@ import Foundation import XCTest @testable import ParseSwift +// swiftlint:disable function_body_length type_body_length + class ParseLiveQueryTests: XCTestCase { struct GameScore: ParseObject { //: These are required by ParseObject @@ -22,7 +24,7 @@ class ParseLiveQueryTests: XCTestCase { //: Your own properties var points: Int = 0 - //custom initializer + // custom initializer init() {} init(points: Int) { @@ -450,7 +452,7 @@ class ParseLiveQueryTests: XCTestCase { client.close() let expectation1 = XCTestExpectation(description: "Response delegate") client.open(isUserWantsToConnect: true) { error in - XCTAssertNotNil(error) //Should always fail since WS is not intercepted. + XCTAssertNotNil(error) // Should always fail since WS is not intercepted. expectation1.fulfill() } wait(for: [expectation1], timeout: 20.0) @@ -706,7 +708,7 @@ class ParseLiveQueryTests: XCTestCase { XCTAssertNil(subscription.unsubscribed) XCTAssertNil(subscription.event) - //Unsubscribe + // Unsubscribe DispatchQueue.main.asyncAfter(deadline: .now() + 2) { guard let unsubscribed = subscription.unsubscribed else { XCTFail("Should unwrap unsubscribed.") @@ -723,7 +725,7 @@ class ParseLiveQueryTests: XCTestCase { XCTAssertEqual(client.pendingSubscriptions.count, 1) XCTAssertEqual(client.subscriptions.count, 1) - //Received Unsubscribe + // Received Unsubscribe let response2 = PreliminaryMessageResponse(op: .unsubscribed, requestId: 1, clientId: "yolo", @@ -776,7 +778,7 @@ class ParseLiveQueryTests: XCTestCase { XCTAssertTrue(isNew) expectation1.fulfill() - //Unsubscribe + // Unsubscribe subscription.handleUnsubscribe { query in XCTAssertEqual(query, subscribedQuery) XCTAssertTrue(client.pendingSubscriptions.isEmpty) @@ -788,7 +790,7 @@ class ParseLiveQueryTests: XCTestCase { XCTAssertEqual(client.pendingSubscriptions.count, 1) XCTAssertEqual(client.subscriptions.count, 1) - //Received Unsubscribe + // Received Unsubscribe let response2 = PreliminaryMessageResponse(op: .unsubscribed, requestId: 1, clientId: "yolo", @@ -863,7 +865,7 @@ class ParseLiveQueryTests: XCTestCase { return } - //Resubscribe + // Resubscribe do { count += 1 subscription = try Query.subscribe(handler) @@ -1276,7 +1278,7 @@ class ParseLiveQueryTests: XCTestCase { expectation1.fulfill() } - //Update + // Update DispatchQueue.main.asyncAfter(deadline: .now() + 2) { guard let subscribed = subscription.subscribed else { XCTFail("Should unwrap") @@ -1362,12 +1364,12 @@ class ParseLiveQueryTests: XCTestCase { expectation1.fulfill() } - //Disconnect, subscriptions should remain the same + // Disconnect, subscriptions should remain the same client.isConnected = false XCTAssertEqual(client.subscriptions.count, 1) XCTAssertEqual(client.pendingSubscriptions.count, 0) - //Connect moving to true should move to pending + // Connect moving to true should move to pending client.clientId = "naw" client.isConnected = true XCTAssertEqual(client.subscriptions.count, 0) @@ -1389,7 +1391,7 @@ class ParseLiveQueryTests: XCTestCase { return } - //Fake server response + // Fake server response let response = PreliminaryMessageResponse(op: .subscribed, requestId: 1, clientId: "yolo", @@ -1662,7 +1664,7 @@ class ParseLiveQueryTests: XCTestCase { return } - //Update + // Update XCTAssertNotNil(try? query.update(subscription)) guard let isSubscribed = try? client.isSubscribed(query), @@ -1736,18 +1738,18 @@ class ParseLiveQueryTests: XCTestCase { return } - //Disconnect, subscriptions should remain the same + // Disconnect, subscriptions should remain the same client.isConnected = false XCTAssertEqual(client.subscriptions.count, 1) XCTAssertEqual(client.pendingSubscriptions.count, 0) - //Connect moving to true should move to pending + // Connect moving to true should move to pending client.clientId = "naw" client.isConnected = true XCTAssertEqual(client.subscriptions.count, 0) XCTAssertEqual(client.pendingSubscriptions.count, 1) - //Fake server response + // Fake server response let response = PreliminaryMessageResponse(op: .subscribed, requestId: 1, clientId: "yolo", diff --git a/Tests/ParseSwiftTests/ParseObjectAsyncTests.swift b/Tests/ParseSwiftTests/ParseObjectAsyncTests.swift index b53e75878..b290d9682 100644 --- a/Tests/ParseSwiftTests/ParseObjectAsyncTests.swift +++ b/Tests/ParseSwiftTests/ParseObjectAsyncTests.swift @@ -14,6 +14,8 @@ import FoundationNetworking import XCTest @testable import ParseSwift +// swiftlint:disable function_body_length + class ParseObjectAsyncTests: XCTestCase { // swiftlint:disable:this type_body_length struct GameScore: ParseObject { @@ -48,7 +50,7 @@ class ParseObjectAsyncTests: XCTestCase { // swiftlint:disable:this type_body_le init() { } - //custom initializers + // custom initializers init (objectId: String?) { self.objectId = objectId } @@ -374,7 +376,7 @@ class ParseObjectAsyncTests: XCTestCase { // swiftlint:disable:this type_body_le let encoded: Data! do { encoded = try ParseCoding.jsonEncoder().encode(scoreOnServer) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy scoreOnServer2 = try scoreOnServer.getDecoder().decode(GameScore.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -413,7 +415,7 @@ class ParseObjectAsyncTests: XCTestCase { // swiftlint:disable:this type_body_le let encoded: Data! do { encoded = try ParseCoding.jsonEncoder().encode(scoreOnServer) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy scoreOnServer = try scoreOnServer.getDecoder().decode(GameScore.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -449,7 +451,7 @@ class ParseObjectAsyncTests: XCTestCase { // swiftlint:disable:this type_body_le let encoded: Data! do { encoded = try originalResponse.getEncoder().encode(originalResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy originalResponse = try originalResponse.getDecoder().decode(GameScore.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -488,7 +490,7 @@ class ParseObjectAsyncTests: XCTestCase { // swiftlint:disable:this type_body_le let encoded: Data! do { encoded = try ParseCoding.jsonEncoder().encode(scoreOnServer) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy scoreOnServer = try scoreOnServer.getDecoder().decode(GameScore.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -527,7 +529,7 @@ class ParseObjectAsyncTests: XCTestCase { // swiftlint:disable:this type_body_le let encoded: Data! do { encoded = try ParseCoding.jsonEncoder().encode(scoreOnServer) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy scoreOnServer = try scoreOnServer.getDecoder().decode(GameScore.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -561,7 +563,7 @@ class ParseObjectAsyncTests: XCTestCase { // swiftlint:disable:this type_body_le let encoded: Data! do { encoded = try ParseCoding.jsonEncoder().encode(scoreOnServer) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy scoreOnServer = try scoreOnServer.getDecoder().decode(GameScore.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -613,7 +615,7 @@ class ParseObjectAsyncTests: XCTestCase { // swiftlint:disable:this type_body_le let encoded: Data! do { encoded = try ParseCoding.jsonEncoder().encode(scoreOnServer) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy scoreOnServer = try scoreOnServer.getDecoder().decode(GameScore.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -704,7 +706,7 @@ class ParseObjectAsyncTests: XCTestCase { // swiftlint:disable:this type_body_le let encoded: Data! do { encoded = try originalResponse.getEncoder().encode(originalResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy originalResponse = try originalResponse.getDecoder().decode(GameScore.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -743,7 +745,7 @@ class ParseObjectAsyncTests: XCTestCase { // swiftlint:disable:this type_body_le let encoded: Data! do { encoded = try originalResponse.getEncoder().encode(originalResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy originalResponse = try originalResponse.getDecoder().decode(GameScoreDefault.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -844,7 +846,7 @@ class ParseObjectAsyncTests: XCTestCase { // swiftlint:disable:this type_body_le let encoded: Data! do { encoded = try ParseCoding.jsonEncoder().encode(response) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy let encoded1 = try ParseCoding.jsonEncoder().encode(scoreOnServer) scoreOnServerImmutable = try scoreOnServer.getDecoder().decode(GameScore.self, from: encoded1) let encoded2 = try ParseCoding.jsonEncoder().encode(scoreOnServer2) @@ -932,7 +934,7 @@ class ParseObjectAsyncTests: XCTestCase { // swiftlint:disable:this type_body_le let encoded: Data! do { encoded = try ParseCoding.jsonEncoder().encode(response) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy let encoded1 = try ParseCoding.jsonEncoder().encode(scoreOnServer) scoreOnServer = try scoreOnServer.getDecoder().decode(GameScore.self, from: encoded1) let encoded2 = try ParseCoding.jsonEncoder().encode(scoreOnServer2) @@ -1003,7 +1005,7 @@ class ParseObjectAsyncTests: XCTestCase { // swiftlint:disable:this type_body_le let encoded: Data! do { encoded = try ParseCoding.jsonEncoder().encode(response) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy let encoded1 = try ParseCoding.jsonEncoder().encode(scoreOnServer) scoreOnServerImmutable = try scoreOnServer.getDecoder().decode(GameScore.self, from: encoded1) let encoded2 = try ParseCoding.jsonEncoder().encode(scoreOnServer2) @@ -1150,7 +1152,7 @@ class ParseObjectAsyncTests: XCTestCase { // swiftlint:disable:this type_body_le let encoded: Data! do { encoded = try ParseCoding.jsonEncoder().encode(response) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy let encoded1 = try ParseCoding.jsonEncoder().encode(scoreOnServer) scoreOnServerImmutable = try scoreOnServer.getDecoder().decode(GameScore.self, from: encoded1) let encoded2 = try ParseCoding.jsonEncoder().encode(scoreOnServer2) @@ -1227,7 +1229,7 @@ class ParseObjectAsyncTests: XCTestCase { // swiftlint:disable:this type_body_le let encoded: Data! do { encoded = try ParseCoding.jsonEncoder().encode(response) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy let encoded1 = try ParseCoding.jsonEncoder().encode(scoreOnServer) scoreOnServerImmutable = try scoreOnServer.getDecoder().decode(GameScore.self, from: encoded1) let encoded2 = try ParseCoding.jsonEncoder().encode(scoreOnServer2) @@ -1348,7 +1350,7 @@ class ParseObjectAsyncTests: XCTestCase { // swiftlint:disable:this type_body_le let encoded: Data! do { encoded = try ParseCoding.jsonEncoder().encode(response) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy let encoded1 = try ParseCoding.jsonEncoder().encode(scoreOnServer) scoreOnServerImmutable = try scoreOnServer.getDecoder().decode(GameScore.self, from: encoded1) let encoded2 = try ParseCoding.jsonEncoder().encode(scoreOnServer2) @@ -1470,7 +1472,6 @@ class ParseObjectAsyncTests: XCTestCase { // swiftlint:disable:this type_body_le } } - // swiftlint:disable:next function_body_length @MainActor func testDeepSaveOneDeep() async throws { let score = GameScore(points: 10) @@ -1486,7 +1487,7 @@ class ParseObjectAsyncTests: XCTestCase { // swiftlint:disable:this type_body_le let encoded: Data! do { encoded = try GameScore.getJSONEncoder().encode(response) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy let encodedScoreOnServer = try scoreOnServer.getEncoder().encode(scoreOnServer) scoreOnServer = try scoreOnServer.getDecoder().decode(GameScore.self, from: encodedScoreOnServer) } catch { @@ -1539,7 +1540,7 @@ class ParseObjectAsyncTests: XCTestCase { // swiftlint:disable:this type_body_le let encodedGamed: Data do { encodedGamed = try game.getEncoder().encode(gameOnServer, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy gameOnServer = try game.getDecoder().decode(Game.self, from: encodedGamed) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -1564,7 +1565,6 @@ class ParseObjectAsyncTests: XCTestCase { // swiftlint:disable:this type_body_le XCTAssertEqual(savedGame.gameScore, gameOnServer.gameScore) } - // swiftlint:disable:next function_body_length @MainActor func testDeepSaveOneDeepWithDefaultACL() async throws { let user = try await loginNormally() @@ -1588,7 +1588,7 @@ class ParseObjectAsyncTests: XCTestCase { // swiftlint:disable:this type_body_le let encoded: Data! do { encoded = try GameScore.getJSONEncoder().encode(response) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy let encodedScoreOnServer = try scoreOnServer.getEncoder().encode(scoreOnServer) scoreOnServer = try scoreOnServer.getDecoder().decode(GameScore.self, from: encodedScoreOnServer) } catch { @@ -1631,7 +1631,7 @@ class ParseObjectAsyncTests: XCTestCase { // swiftlint:disable:this type_body_le return } - //Setup ParseObject to return from mocker + // Setup ParseObject to return from mocker MockURLProtocol.removeAll() var gameOnServer = game @@ -1641,7 +1641,7 @@ class ParseObjectAsyncTests: XCTestCase { // swiftlint:disable:this type_body_le let encodedGamed: Data do { encodedGamed = try game.getEncoder().encode(gameOnServer, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy gameOnServer = try game.getDecoder().decode(Game.self, from: encodedGamed) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -1756,7 +1756,6 @@ class ParseObjectAsyncTests: XCTestCase { // swiftlint:disable:this type_body_le } #if !os(Linux) && !os(Android) && !os(Windows) - // swiftlint:disable:next function_body_length @MainActor func testDeepSaveObjectWithFile() async throws { var game = Game2() @@ -1800,10 +1799,10 @@ class ParseObjectAsyncTests: XCTestCase { // swiftlint:disable:this type_body_le counter += 1 } - //Saved updated info for game + // Saved updated info for game game.profilePicture = savedFile - //Setup ParseObject to return from mocker + // Setup ParseObject to return from mocker MockURLProtocol.removeAll() var gameOnServer = game @@ -1814,7 +1813,7 @@ class ParseObjectAsyncTests: XCTestCase { // swiftlint:disable:this type_body_le let encodedGamed: Data do { encodedGamed = try game.getEncoder().encode(gameOnServer, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy gameOnServer = try game.getDecoder().decode(Game2.self, from: encodedGamed) } catch { XCTFail("Should encode/decode. Error \(error)") diff --git a/Tests/ParseSwiftTests/ParseObjectBatchTests.swift b/Tests/ParseSwiftTests/ParseObjectBatchTests.swift index 17de50281..bc5bf57d7 100644 --- a/Tests/ParseSwiftTests/ParseObjectBatchTests.swift +++ b/Tests/ParseSwiftTests/ParseObjectBatchTests.swift @@ -245,7 +245,7 @@ class ParseObjectBatchTests: XCTestCase { // swiftlint:disable:this type_body_le } } - func testSaveAllWithPointer() { // swiftlint:disable:this function_body_length cyclomatic_complexity + func testSaveAllWithPointer() { var score = GameScore(points: 10) score.other = Game2() @@ -303,7 +303,7 @@ class ParseObjectBatchTests: XCTestCase { // swiftlint:disable:this type_body_le } } - func testSaveAllWithPointerArray() { // swiftlint:disable:this function_body_length cyclomatic_complexity + func testSaveAllWithPointerArray() { var score = GameScore(points: 10) score.otherArray = [Game2()] @@ -361,7 +361,7 @@ class ParseObjectBatchTests: XCTestCase { // swiftlint:disable:this type_body_le } } - func testSaveAllTransaction() { // swiftlint:disable:this function_body_length cyclomatic_complexity + func testSaveAllTransaction() { // swiftlint:disable:this function_body_length let score = GameScore(points: 10) let score2 = GameScore(points: 20) @@ -380,7 +380,7 @@ class ParseObjectBatchTests: XCTestCase { // swiftlint:disable:this type_body_le let encoded: Data! do { encoded = try scoreOnServer.getJSONEncoder().encode(response) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy let encoded1 = try ParseCoding.jsonEncoder().encode(scoreOnServer) scoreOnServer = try scoreOnServer.getDecoder().decode(GameScore.self, from: encoded1) let encoded2 = try ParseCoding.jsonEncoder().encode(scoreOnServer2) @@ -575,7 +575,7 @@ class ParseObjectBatchTests: XCTestCase { // swiftlint:disable:this type_body_le let encoded: Data! do { encoded = try ParseCoding.jsonEncoder().encode(response) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy let encoded1 = try ParseCoding.jsonEncoder().encode(scoreOnServer) scoreOnServer = try scoreOnServer.getDecoder().decode(GameScore.self, from: encoded1) let encoded2 = try ParseCoding.jsonEncoder().encode(scoreOnServer2) @@ -748,7 +748,7 @@ class ParseObjectBatchTests: XCTestCase { // swiftlint:disable:this type_body_le let encoded: Data! do { encoded = try ParseCoding.jsonEncoder().encode(response) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy let encoded1 = try ParseCoding.jsonEncoder().encode(scoreOnServer) scoreOnServer = try scoreOnServer.getDecoder().decode(GameScore.self, from: encoded1) let encoded2 = try ParseCoding.jsonEncoder().encode(scoreOnServer2) @@ -956,7 +956,7 @@ class ParseObjectBatchTests: XCTestCase { // swiftlint:disable:this type_body_le wait(for: [expectation1, expectation2], timeout: 20.0) } - func saveAllAsyncPointer(scores: [GameScore], // swiftlint:disable:this function_body_length cyclomatic_complexity + func saveAllAsyncPointer(scores: [GameScore], // swiftlint:disable:this function_body_length transaction: Bool = false, scoresOnServer: [GameScore], callbackQueue: DispatchQueue) { @@ -1044,7 +1044,7 @@ class ParseObjectBatchTests: XCTestCase { // swiftlint:disable:this type_body_le let encoded: Data! do { encoded = try ParseCoding.jsonEncoder().encode(response) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy let encoded1 = try ParseCoding.jsonEncoder().encode(scoreOnServer) scoreOnServer = try scoreOnServer.getDecoder().decode(GameScore.self, from: encoded1) let encoded2 = try ParseCoding.jsonEncoder().encode(scoreOnServer2) @@ -1084,7 +1084,7 @@ class ParseObjectBatchTests: XCTestCase { // swiftlint:disable:this type_body_le let encoded: Data! do { encoded = try ParseCoding.jsonEncoder().encode(response) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy let encoded1 = try ParseCoding.jsonEncoder().encode(scoreOnServer) scoreOnServer = try scoreOnServer.getDecoder().decode(GameScore.self, from: encoded1) let encoded2 = try ParseCoding.jsonEncoder().encode(scoreOnServer2) @@ -1172,7 +1172,7 @@ class ParseObjectBatchTests: XCTestCase { // swiftlint:disable:this type_body_le callbackQueue: .main) } - func testSaveAllAsyncTransaction() { // swiftlint:disable:this function_body_length cyclomatic_complexity + func testSaveAllAsyncTransaction() { let score = GameScore(points: 10) let score2 = GameScore(points: 20) @@ -1191,7 +1191,7 @@ class ParseObjectBatchTests: XCTestCase { // swiftlint:disable:this type_body_le let encoded: Data! do { encoded = try scoreOnServer.getJSONEncoder().encode(response) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy let encoded1 = try ParseCoding.jsonEncoder().encode(scoreOnServer) scoreOnServer = try scoreOnServer.getDecoder().decode(GameScore.self, from: encoded1) let encoded2 = try ParseCoding.jsonEncoder().encode(scoreOnServer2) @@ -1404,7 +1404,7 @@ class ParseObjectBatchTests: XCTestCase { // swiftlint:disable:this type_body_le let encoded: Data! do { encoded = try ParseCoding.jsonEncoder().encode(response) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy let encoded1 = try ParseCoding.jsonEncoder().encode(scoreOnServer) scoreOnServer = try scoreOnServer.getDecoder().decode(GameScore.self, from: encoded1) let encoded2 = try ParseCoding.jsonEncoder().encode(scoreOnServer2) @@ -1447,7 +1447,7 @@ class ParseObjectBatchTests: XCTestCase { // swiftlint:disable:this type_body_le let encoded: Data! do { encoded = try ParseCoding.jsonEncoder().encode(response) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy let encoded1 = try ParseCoding.jsonEncoder().encode(scoreOnServer) scoreOnServer = try scoreOnServer.getDecoder().decode(GameScore.self, from: encoded1) let encoded2 = try ParseCoding.jsonEncoder().encode(scoreOnServer2) @@ -1487,7 +1487,7 @@ class ParseObjectBatchTests: XCTestCase { // swiftlint:disable:this type_body_le let encoded: Data! do { encoded = try ParseCoding.jsonEncoder().encode(response) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy let encoded1 = try ParseCoding.jsonEncoder().encode(scoreOnServer) scoreOnServer = try scoreOnServer.getDecoder().decode(GameScore.self, from: encoded1) let encoded2 = try ParseCoding.jsonEncoder().encode(scoreOnServer2) @@ -1666,7 +1666,7 @@ class ParseObjectBatchTests: XCTestCase { // swiftlint:disable:this type_body_le let encoded: Data! do { encoded = try ParseCoding.jsonEncoder().encode(response) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy let encoded1 = try ParseCoding.jsonEncoder().encode(scoreOnServer) scoreOnServer = try scoreOnServer.getDecoder().decode(GameScore.self, from: encoded1) let encoded2 = try ParseCoding.jsonEncoder().encode(scoreOnServer2) @@ -1707,7 +1707,7 @@ class ParseObjectBatchTests: XCTestCase { // swiftlint:disable:this type_body_le let encoded: Data! do { encoded = try ParseCoding.jsonEncoder().encode(response) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy let encoded1 = try ParseCoding.jsonEncoder().encode(scoreOnServer) scoreOnServer = try scoreOnServer.getDecoder().decode(GameScore.self, from: encoded1) let encoded2 = try ParseCoding.jsonEncoder().encode(scoreOnServer2) @@ -1724,6 +1724,7 @@ class ParseObjectBatchTests: XCTestCase { // swiftlint:disable:this type_body_le callbackQueue: .main) } + // swiftlint:disable:next cyclomatic_complexity function_body_length func testDeleteAll() { let response = [BatchResponseItem(success: NoBody(), error: nil), BatchResponseItem(success: NoBody(), error: nil)] @@ -1791,6 +1792,7 @@ class ParseObjectBatchTests: XCTestCase { // swiftlint:disable:this type_body_le } } + // swiftlint:disable:next cyclomatic_complexity function_body_length func testDeleteAllTransaction() { let response = [BatchResponseItem(success: NoBody(), error: nil), BatchResponseItem(success: NoBody(), error: nil)] @@ -1922,6 +1924,7 @@ class ParseObjectBatchTests: XCTestCase { // swiftlint:disable:this type_body_le } #endif + // swiftlint:disable:next cyclomatic_complexity function_body_length func deleteAllAsync(transaction: Bool = false, callbackQueue: DispatchQueue) { let expectation1 = XCTestExpectation(description: "Delete object1") diff --git a/Tests/ParseSwiftTests/ParseObjectCombineTests.swift b/Tests/ParseSwiftTests/ParseObjectCombineTests.swift index d6d83e6f7..7e2f593fb 100644 --- a/Tests/ParseSwiftTests/ParseObjectCombineTests.swift +++ b/Tests/ParseSwiftTests/ParseObjectCombineTests.swift @@ -13,6 +13,8 @@ import XCTest import Combine @testable import ParseSwift +// swiftlint:disable function_body_length + class ParseObjectCombineTests: XCTestCase { // swiftlint:disable:this type_body_length struct GameScore: ParseObject { @@ -27,7 +29,7 @@ class ParseObjectCombineTests: XCTestCase { // swiftlint:disable:this type_body_ var points: Int? var player: String? - //custom initializers + // custom initializers init() {} init (objectId: String?) { self.objectId = objectId @@ -80,7 +82,7 @@ class ParseObjectCombineTests: XCTestCase { // swiftlint:disable:this type_body_ let encoded: Data! do { encoded = try ParseCoding.jsonEncoder().encode(scoreOnServer) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy scoreOnServer = try scoreOnServer.getDecoder().decode(GameScore.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -135,7 +137,7 @@ class ParseObjectCombineTests: XCTestCase { // swiftlint:disable:this type_body_ let encoded: Data! do { encoded = try ParseCoding.jsonEncoder().encode(scoreOnServer) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy scoreOnServer = try scoreOnServer.getDecoder().decode(GameScore.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -185,7 +187,7 @@ class ParseObjectCombineTests: XCTestCase { // swiftlint:disable:this type_body_ let encoded: Data! do { encoded = try ParseCoding.jsonEncoder().encode(scoreOnServer) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy scoreOnServer = try scoreOnServer.getDecoder().decode(GameScore.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -239,7 +241,7 @@ class ParseObjectCombineTests: XCTestCase { // swiftlint:disable:this type_body_ let encoded: Data! do { encoded = try ParseCoding.jsonEncoder().encode(scoreOnServer) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy scoreOnServer = try scoreOnServer.getDecoder().decode(GameScore.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -314,6 +316,7 @@ class ParseObjectCombineTests: XCTestCase { // swiftlint:disable:this type_body_ wait(for: [expectation1], timeout: 20.0) } + // swiftlint:disable:next cyclomatic_complexity func testFetchAll() { var subscriptions = Set() let expectation1 = XCTestExpectation(description: "Fetch") @@ -337,7 +340,7 @@ class ParseObjectCombineTests: XCTestCase { // swiftlint:disable:this type_body_ let encoded: Data! do { encoded = try ParseCoding.jsonEncoder().encode(response) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy let encoded1 = try ParseCoding.jsonEncoder().encode(scoreOnServer) scoreOnServer = try scoreOnServer.getDecoder().decode(GameScore.self, from: encoded1) let encoded2 = try ParseCoding.jsonEncoder().encode(scoreOnServer2) @@ -439,7 +442,7 @@ class ParseObjectCombineTests: XCTestCase { // swiftlint:disable:this type_body_ let encoded: Data! do { encoded = try ParseCoding.jsonEncoder().encode(response) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy let encoded1 = try ParseCoding.jsonEncoder().encode(scoreOnServer) scoreOnServer = try scoreOnServer.getDecoder().decode(GameScore.self, from: encoded1) let encoded2 = try ParseCoding.jsonEncoder().encode(scoreOnServer2) @@ -521,7 +524,7 @@ class ParseObjectCombineTests: XCTestCase { // swiftlint:disable:this type_body_ let encoded: Data! do { encoded = try ParseCoding.jsonEncoder().encode(response) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy let encoded1 = try ParseCoding.jsonEncoder().encode(scoreOnServer) scoreOnServer = try scoreOnServer.getDecoder().decode(GameScore.self, from: encoded1) let encoded2 = try ParseCoding.jsonEncoder().encode(scoreOnServer2) @@ -609,7 +612,7 @@ class ParseObjectCombineTests: XCTestCase { // swiftlint:disable:this type_body_ let encoded: Data! do { encoded = try ParseCoding.jsonEncoder().encode(response) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy let encoded1 = try ParseCoding.jsonEncoder().encode(scoreOnServer) scoreOnServer = try scoreOnServer.getDecoder().decode(GameScore.self, from: encoded1) let encoded2 = try ParseCoding.jsonEncoder().encode(scoreOnServer2) @@ -687,7 +690,7 @@ class ParseObjectCombineTests: XCTestCase { // swiftlint:disable:this type_body_ let encoded: Data! do { encoded = try ParseCoding.jsonEncoder().encode(response) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy let encoded1 = try ParseCoding.jsonEncoder().encode(scoreOnServer) scoreOnServer = try scoreOnServer.getDecoder().decode(GameScore.self, from: encoded1) let encoded2 = try ParseCoding.jsonEncoder().encode(scoreOnServer2) @@ -771,7 +774,7 @@ class ParseObjectCombineTests: XCTestCase { // swiftlint:disable:this type_body_ let encoded: Data! do { encoded = try ParseCoding.jsonEncoder().encode(response) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy let encoded1 = try ParseCoding.jsonEncoder().encode(scoreOnServer) scoreOnServer = try scoreOnServer.getDecoder().decode(GameScore.self, from: encoded1) let encoded2 = try ParseCoding.jsonEncoder().encode(scoreOnServer2) diff --git a/Tests/ParseSwiftTests/ParseObjectCustomObjectIdTests.swift b/Tests/ParseSwiftTests/ParseObjectCustomObjectIdTests.swift index 21913cae3..61d1215c4 100644 --- a/Tests/ParseSwiftTests/ParseObjectCustomObjectIdTests.swift +++ b/Tests/ParseSwiftTests/ParseObjectCustomObjectIdTests.swift @@ -39,7 +39,7 @@ class ParseObjectCustomObjectIdTests: XCTestCase { // swiftlint:disable:this typ var level: Level? var levels: [Level]? - //custom initializers + // custom initializers init() {} init (objectId: String?) { self.objectId = objectId @@ -553,7 +553,7 @@ class ParseObjectCustomObjectIdTests: XCTestCase { // swiftlint:disable:this typ XCTAssertThrowsError(try objects.map { try $0.saveCommand() }) } - func testSave() { // swiftlint:disable:this function_body_length + func testSave() { var score = GameScore(points: 10) score.objectId = "yarr" @@ -563,7 +563,7 @@ class ParseObjectCustomObjectIdTests: XCTestCase { // swiftlint:disable:this typ let encoded: Data! do { encoded = try ParseCoding.jsonEncoder().encode(scoreOnServer) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy scoreOnServer = try scoreOnServer.getDecoder().decode(GameScore.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -586,7 +586,7 @@ class ParseObjectCustomObjectIdTests: XCTestCase { // swiftlint:disable:this typ XCTAssertThrowsError(try score.save()) } - func testSaveNoObjectIdIgnoreConfig() { // swiftlint:disable:this function_body_length + func testSaveNoObjectIdIgnoreConfig() { let score = GameScore(points: 10) var scoreOnServer = score @@ -596,7 +596,7 @@ class ParseObjectCustomObjectIdTests: XCTestCase { // swiftlint:disable:this typ let encoded: Data! do { encoded = try ParseCoding.jsonEncoder().encode(scoreOnServer) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy scoreOnServer = try scoreOnServer.getDecoder().decode(GameScore.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -627,7 +627,7 @@ class ParseObjectCustomObjectIdTests: XCTestCase { // swiftlint:disable:this typ let encoded: Data! do { encoded = try ParseCoding.jsonEncoder().encode(scoreOnServer) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy scoreOnServer = try scoreOnServer.getDecoder().decode(GameScore.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -664,7 +664,7 @@ class ParseObjectCustomObjectIdTests: XCTestCase { // swiftlint:disable:this typ let encoded: Data! do { encoded = try ParseCoding.jsonEncoder().encode(scoreOnServer) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy scoreOnServer = try scoreOnServer.getDecoder().decode(GameScore.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -682,7 +682,6 @@ class ParseObjectCustomObjectIdTests: XCTestCase { // swiftlint:disable:this typ } } - // swiftlint:disable:next function_body_length func saveAsync(score: GameScore, scoreOnServer: GameScore, callbackQueue: DispatchQueue, @@ -732,7 +731,7 @@ class ParseObjectCustomObjectIdTests: XCTestCase { // swiftlint:disable:this typ let encoded: Data! do { encoded = try ParseCoding.jsonEncoder().encode(scoreOnServer) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy scoreOnServer = try scoreOnServer.getDecoder().decode(GameScore.self, from: encoded) } catch { XCTFail("Should have encoded/decoded: Error: \(error)") @@ -772,7 +771,7 @@ class ParseObjectCustomObjectIdTests: XCTestCase { // swiftlint:disable:this typ let encoded: Data! do { encoded = try ParseCoding.jsonEncoder().encode(scoreOnServer) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy scoreOnServer = try scoreOnServer.getDecoder().decode(GameScore.self, from: encoded) } catch { XCTFail("Should have encoded/decoded: Error: \(error)") @@ -840,7 +839,7 @@ class ParseObjectCustomObjectIdTests: XCTestCase { // swiftlint:disable:this typ let encoded: Data! do { encoded = try ParseCoding.jsonEncoder().encode(scoreOnServer) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy scoreOnServer = try scoreOnServer.getDecoder().decode(GameScore.self, from: encoded) } catch { XCTFail("Should have encoded/decoded: Error: \(error)") @@ -880,7 +879,7 @@ class ParseObjectCustomObjectIdTests: XCTestCase { // swiftlint:disable:this typ let encoded: Data! do { encoded = try ParseCoding.jsonEncoder().encode(scoreOnServer) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy scoreOnServer = try scoreOnServer.getDecoder().decode(GameScore.self, from: encoded) } catch { XCTFail("Should have encoded/decoded: Error: \(error)") @@ -895,7 +894,7 @@ class ParseObjectCustomObjectIdTests: XCTestCase { // swiftlint:disable:this typ callbackQueue: .main) } - func testSaveAll() { // swiftlint:disable:this function_body_length cyclomatic_complexity + func testSaveAll() { var score = GameScore(points: 10) score.objectId = "yarr" var score2 = GameScore(points: 20) @@ -914,7 +913,7 @@ class ParseObjectCustomObjectIdTests: XCTestCase { // swiftlint:disable:this typ let encoded: Data! do { encoded = try scoreOnServer.getJSONEncoder().encode(response) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy let encoded1 = try ParseCoding.jsonEncoder().encode(scoreOnServer) scoreOnServer = try scoreOnServer.getDecoder().decode(GameScore.self, from: encoded1) let encoded2 = try ParseCoding.jsonEncoder().encode(scoreOnServer2) @@ -960,7 +959,7 @@ class ParseObjectCustomObjectIdTests: XCTestCase { // swiftlint:disable:this typ XCTAssertThrowsError(try [score, score2].saveAll()) } - func testSaveAllNoObjectIdIgnoreConfig() { // swiftlint:disable:this function_body_length cyclomatic_complexity + func testSaveAllNoObjectIdIgnoreConfig() { let score = GameScore(points: 10) let score2 = GameScore(points: 20) @@ -979,7 +978,7 @@ class ParseObjectCustomObjectIdTests: XCTestCase { // swiftlint:disable:this typ let encoded: Data! do { encoded = try scoreOnServer.getJSONEncoder().encode(response) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy let encoded1 = try ParseCoding.jsonEncoder().encode(scoreOnServer) scoreOnServer = try scoreOnServer.getDecoder().decode(GameScore.self, from: encoded1) let encoded2 = try ParseCoding.jsonEncoder().encode(scoreOnServer2) @@ -1035,7 +1034,7 @@ class ParseObjectCustomObjectIdTests: XCTestCase { // swiftlint:disable:this typ wait(for: [expectation1], timeout: 20.0) } - func testUpdateAll() { // swiftlint:disable:this function_body_length cyclomatic_complexity + func testUpdateAll() { var score = GameScore(points: 10) score.objectId = "yarr" score.createdAt = Date() @@ -1056,7 +1055,7 @@ class ParseObjectCustomObjectIdTests: XCTestCase { // swiftlint:disable:this typ let encoded: Data! do { encoded = try scoreOnServer.getJSONEncoder().encode(response) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy let encoded1 = try ParseCoding.jsonEncoder().encode(scoreOnServer) scoreOnServer = try scoreOnServer.getDecoder().decode(GameScore.self, from: encoded1) let encoded2 = try ParseCoding.jsonEncoder().encode(scoreOnServer2) @@ -1122,7 +1121,7 @@ class ParseObjectCustomObjectIdTests: XCTestCase { // swiftlint:disable:this typ wait(for: [expectation1], timeout: 20.0) } - func testUserSave() { // swiftlint:disable:this function_body_length + func testUserSave() { var user = User() user.objectId = "yarr" user.ACL = nil @@ -1133,7 +1132,7 @@ class ParseObjectCustomObjectIdTests: XCTestCase { // swiftlint:disable:this typ let encoded: Data! do { encoded = try ParseCoding.jsonEncoder().encode(userOnServer) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try userOnServer.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -1156,7 +1155,7 @@ class ParseObjectCustomObjectIdTests: XCTestCase { // swiftlint:disable:this typ XCTAssertThrowsError(try score.save()) } - func testUserSaveNoObjectIdIgnoreConfig() { // swiftlint:disable:this function_body_length + func testUserSaveNoObjectIdIgnoreConfig() { var user = User() user.ACL = nil @@ -1167,7 +1166,7 @@ class ParseObjectCustomObjectIdTests: XCTestCase { // swiftlint:disable:this typ let encoded: Data! do { encoded = try ParseCoding.jsonEncoder().encode(userOnServer) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try userOnServer.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -1198,7 +1197,7 @@ class ParseObjectCustomObjectIdTests: XCTestCase { // swiftlint:disable:this typ let encoded: Data! do { encoded = try ParseCoding.jsonEncoder().encode(userOnServer) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try userOnServer.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -1235,7 +1234,7 @@ class ParseObjectCustomObjectIdTests: XCTestCase { // swiftlint:disable:this typ let encoded: Data! do { encoded = try ParseCoding.jsonEncoder().encode(userOnServer) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try userOnServer.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -1253,7 +1252,6 @@ class ParseObjectCustomObjectIdTests: XCTestCase { // swiftlint:disable:this typ } } - // swiftlint:disable:next function_body_length func saveUserAsync(user: User, userOnServer: User, ignoringCustomObjectIdConfig: Bool = false, callbackQueue: DispatchQueue) { @@ -1286,7 +1284,7 @@ class ParseObjectCustomObjectIdTests: XCTestCase { // swiftlint:disable:this typ let encoded: Data! do { encoded = try ParseCoding.jsonEncoder().encode(userOnServer) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try userOnServer.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should have encoded/decoded: Error: \(error)") @@ -1324,7 +1322,7 @@ class ParseObjectCustomObjectIdTests: XCTestCase { // swiftlint:disable:this typ let encoded: Data! do { encoded = try ParseCoding.jsonEncoder().encode(userOnServer) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try userOnServer.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should have encoded/decoded: Error: \(error)") @@ -1371,7 +1369,7 @@ class ParseObjectCustomObjectIdTests: XCTestCase { // swiftlint:disable:this typ let encoded: Data! do { encoded = try ParseCoding.jsonEncoder().encode(userOnServer) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try userOnServer.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should have encoded/decoded: Error: \(error)") @@ -1400,7 +1398,7 @@ class ParseObjectCustomObjectIdTests: XCTestCase { // swiftlint:disable:this typ wait(for: [expectation1], timeout: 20.0) } - func testUserSaveAll() { // swiftlint:disable:this function_body_length cyclomatic_complexity + func testUserSaveAll() { var user = User() user.objectId = "yarr" @@ -1420,7 +1418,7 @@ class ParseObjectCustomObjectIdTests: XCTestCase { // swiftlint:disable:this typ let encoded: Data! do { encoded = try userOnServer.getJSONEncoder().encode(response) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy let encoded1 = try ParseCoding.jsonEncoder().encode(userOnServer) userOnServer = try userOnServer.getDecoder().decode(User.self, from: encoded1) let encoded2 = try ParseCoding.jsonEncoder().encode(userOnServer2) @@ -1482,7 +1480,7 @@ class ParseObjectCustomObjectIdTests: XCTestCase { // swiftlint:disable:this typ wait(for: [expectation1], timeout: 20.0) } - func testUserUpdateAll() { // swiftlint:disable:this function_body_length cyclomatic_complexity + func testUserUpdateAll() { var user = User() user.objectId = "yarr" user.createdAt = Date() @@ -1503,7 +1501,7 @@ class ParseObjectCustomObjectIdTests: XCTestCase { // swiftlint:disable:this typ let encoded: Data! do { encoded = try userOnServer.getJSONEncoder().encode(response) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy let encoded1 = try ParseCoding.jsonEncoder().encode(userOnServer) userOnServer = try userOnServer.getDecoder().decode(User.self, from: encoded1) let encoded2 = try ParseCoding.jsonEncoder().encode(userOnServer2) @@ -1551,7 +1549,6 @@ class ParseObjectCustomObjectIdTests: XCTestCase { // swiftlint:disable:this typ XCTAssertThrowsError(try [user, user2].saveAll()) } - // swiftlint:disable:next function_body_length cyclomatic_complexity func testUserUpdateAllNoObjectIdIgnoreConfig() { var user = User() user.createdAt = Date() @@ -1573,7 +1570,7 @@ class ParseObjectCustomObjectIdTests: XCTestCase { // swiftlint:disable:this typ let encoded: Data! do { encoded = try userOnServer.getJSONEncoder().encode(response) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy let encoded1 = try ParseCoding.jsonEncoder().encode(userOnServer) userOnServer = try userOnServer.getDecoder().decode(User.self, from: encoded1) let encoded2 = try ParseCoding.jsonEncoder().encode(userOnServer2) @@ -1631,7 +1628,7 @@ class ParseObjectCustomObjectIdTests: XCTestCase { // swiftlint:disable:this typ wait(for: [expectation1], timeout: 20.0) } - func testInstallationSave() { // swiftlint:disable:this function_body_length + func testInstallationSave() { var installation = Installation() installation.objectId = "yarr" installation.ACL = nil @@ -1642,7 +1639,7 @@ class ParseObjectCustomObjectIdTests: XCTestCase { // swiftlint:disable:this typ let encoded: Data! do { encoded = try ParseCoding.jsonEncoder().encode(installationOnServer) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy installationOnServer = try installationOnServer.getDecoder().decode(Installation.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -1665,7 +1662,7 @@ class ParseObjectCustomObjectIdTests: XCTestCase { // swiftlint:disable:this typ XCTAssertThrowsError(try score.save()) } - func testInstallationSaveNoObjectIdIgnoreConfig() { // swiftlint:disable:this function_body_length + func testInstallationSaveNoObjectIdIgnoreConfig() { var installation = Installation() installation.ACL = nil @@ -1676,7 +1673,7 @@ class ParseObjectCustomObjectIdTests: XCTestCase { // swiftlint:disable:this typ let encoded: Data! do { encoded = try ParseCoding.jsonEncoder().encode(installationOnServer) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy installationOnServer = try installationOnServer.getDecoder().decode(Installation.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -1707,7 +1704,7 @@ class ParseObjectCustomObjectIdTests: XCTestCase { // swiftlint:disable:this typ let encoded: Data! do { encoded = try ParseCoding.jsonEncoder().encode(installationOnServer) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy installationOnServer = try installationOnServer.getDecoder().decode(Installation.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -1744,7 +1741,7 @@ class ParseObjectCustomObjectIdTests: XCTestCase { // swiftlint:disable:this typ let encoded: Data! do { encoded = try ParseCoding.jsonEncoder().encode(installationOnServer) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy installationOnServer = try installationOnServer.getDecoder().decode(Installation.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -1762,7 +1759,6 @@ class ParseObjectCustomObjectIdTests: XCTestCase { // swiftlint:disable:this typ } } - // swiftlint:disable:next function_body_length func saveInstallationAsync(installation: Installation, installationOnServer: Installation, ignoringCustomObjectIdConfig: Bool = false, @@ -1811,7 +1807,7 @@ class ParseObjectCustomObjectIdTests: XCTestCase { // swiftlint:disable:this typ let encoded: Data! do { encoded = try ParseCoding.jsonEncoder().encode(installationOnServer) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy installationOnServer = try installationOnServer.getDecoder().decode(Installation.self, from: encoded) } catch { XCTFail("Should have encoded/decoded: Error: \(error)") @@ -1852,7 +1848,7 @@ class ParseObjectCustomObjectIdTests: XCTestCase { // swiftlint:disable:this typ let encoded: Data! do { encoded = try ParseCoding.jsonEncoder().encode(installationOnServer) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy installationOnServer = try installationOnServer.getDecoder().decode(Installation.self, from: encoded) } catch { XCTFail("Should have encoded/decoded: Error: \(error)") @@ -1902,7 +1898,7 @@ class ParseObjectCustomObjectIdTests: XCTestCase { // swiftlint:disable:this typ let encoded: Data! do { encoded = try ParseCoding.jsonEncoder().encode(installationOnServer) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy installationOnServer = try installationOnServer.getDecoder().decode(Installation.self, from: encoded) } catch { XCTFail("Should have encoded/decoded: Error: \(error)") @@ -1945,7 +1941,7 @@ class ParseObjectCustomObjectIdTests: XCTestCase { // swiftlint:disable:this typ let encoded: Data! do { encoded = try ParseCoding.jsonEncoder().encode(installationOnServer) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy installationOnServer = try installationOnServer.getDecoder().decode(Installation.self, from: encoded) } catch { XCTFail("Should have encoded/decoded: Error: \(error)") @@ -1960,7 +1956,7 @@ class ParseObjectCustomObjectIdTests: XCTestCase { // swiftlint:disable:this typ callbackQueue: .main) } - func testInstallationSaveAll() { // swiftlint:disable:this function_body_length cyclomatic_complexity + func testInstallationSaveAll() { // swiftlint:disable:this function_body_length var installation = Installation() installation.objectId = "yarr" @@ -1980,7 +1976,7 @@ class ParseObjectCustomObjectIdTests: XCTestCase { // swiftlint:disable:this typ let encoded: Data! do { encoded = try installationOnServer.getJSONEncoder().encode(response) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy let encoded1 = try ParseCoding.jsonEncoder().encode(installationOnServer) installationOnServer = try installationOnServer.getDecoder().decode(Installation.self, from: encoded1) let encoded2 = try ParseCoding.jsonEncoder().encode(installationOnServer2) @@ -2034,7 +2030,7 @@ class ParseObjectCustomObjectIdTests: XCTestCase { // swiftlint:disable:this typ XCTAssertThrowsError(try [installation, installation2].saveAll()) } - func testInstallationSaveAllIgnoreConfig() { // swiftlint:disable:this function_body_length cyclomatic_complexity + func testInstallationSaveAllIgnoreConfig() { // swiftlint:disable:this function_body_length let installation = Installation() let installation2 = Installation() @@ -2054,7 +2050,7 @@ class ParseObjectCustomObjectIdTests: XCTestCase { // swiftlint:disable:this typ let encoded: Data! do { encoded = try installationOnServer.getJSONEncoder().encode(response) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy let encoded1 = try ParseCoding.jsonEncoder().encode(installationOnServer) installationOnServer = try installationOnServer.getDecoder().decode(Installation.self, from: encoded1) let encoded2 = try ParseCoding.jsonEncoder().encode(installationOnServer2) @@ -2118,7 +2114,7 @@ class ParseObjectCustomObjectIdTests: XCTestCase { // swiftlint:disable:this typ wait(for: [expectation1], timeout: 20.0) } - func testInstallationUpdateAll() { // swiftlint:disable:this function_body_length cyclomatic_complexity + func testInstallationUpdateAll() { var installation = Installation() installation.objectId = "yarr" installation.createdAt = Date() @@ -2139,7 +2135,7 @@ class ParseObjectCustomObjectIdTests: XCTestCase { // swiftlint:disable:this typ let encoded: Data! do { encoded = try installationOnServer.getJSONEncoder().encode(response) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy let encoded1 = try ParseCoding.jsonEncoder().encode(installationOnServer) installationOnServer = try installationOnServer.getDecoder().decode(Installation.self, from: encoded1) let encoded2 = try ParseCoding.jsonEncoder().encode(installationOnServer2) @@ -2187,7 +2183,6 @@ class ParseObjectCustomObjectIdTests: XCTestCase { // swiftlint:disable:this typ XCTAssertThrowsError(try [installation, installation2].saveAll()) } - // swiftlint:disable:next function_body_length cyclomatic_complexity func testInstallationUpdateAllNoObjectIdIgnoreConfig() { var installation = Installation() installation.createdAt = Date() @@ -2209,7 +2204,7 @@ class ParseObjectCustomObjectIdTests: XCTestCase { // swiftlint:disable:this typ let encoded: Data! do { encoded = try installationOnServer.getJSONEncoder().encode(response) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy let encoded1 = try ParseCoding.jsonEncoder().encode(installationOnServer) installationOnServer = try installationOnServer.getDecoder().decode(Installation.self, from: encoded1) let encoded2 = try ParseCoding.jsonEncoder().encode(installationOnServer2) @@ -2267,7 +2262,6 @@ class ParseObjectCustomObjectIdTests: XCTestCase { // swiftlint:disable:this typ wait(for: [expectation1], timeout: 20.0) } - // swiftlint:disable:next function_body_length func testFetch() { var score = GameScore(points: 10) let objectId = "yarr" @@ -2280,7 +2274,7 @@ class ParseObjectCustomObjectIdTests: XCTestCase { // swiftlint:disable:this typ let encoded: Data! do { encoded = try ParseCoding.jsonEncoder().encode(scoreOnServer) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy scoreOnServer = try scoreOnServer.getDecoder().decode(GameScore.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -2311,7 +2305,7 @@ class ParseObjectCustomObjectIdTests: XCTestCase { // swiftlint:disable:this typ } } - func testFetchUser() { // swiftlint:disable:this function_body_length + func testFetchUser() { var user = User() let objectId = "yarr" user.objectId = objectId @@ -2323,7 +2317,7 @@ class ParseObjectCustomObjectIdTests: XCTestCase { // swiftlint:disable:this typ let encoded: Data! do { encoded = try userOnServer.getEncoder().encode(userOnServer, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try userOnServer.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") diff --git a/Tests/ParseSwiftTests/ParseObjectTests.swift b/Tests/ParseSwiftTests/ParseObjectTests.swift index db12bd3af..ca1a2986c 100644 --- a/Tests/ParseSwiftTests/ParseObjectTests.swift +++ b/Tests/ParseSwiftTests/ParseObjectTests.swift @@ -662,7 +662,7 @@ class ParseObjectTests: XCTestCase { // swiftlint:disable:this type_body_length let encoded: Data! do { encoded = try ParseCoding.jsonEncoder().encode(scoreOnServer) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy scoreOnServer = try GameScore.getDecoder().decode(GameScore.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -725,7 +725,7 @@ class ParseObjectTests: XCTestCase { // swiftlint:disable:this type_body_length let encoded: Data! do { encoded = try ParseCoding.jsonEncoder().encode(scoreOnServer) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy scoreOnServer = try scoreOnServer.getDecoder().decode(GameScore.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -833,7 +833,7 @@ class ParseObjectTests: XCTestCase { // swiftlint:disable:this type_body_length let encoded: Data! do { encoded = try ParseCoding.jsonEncoder().encode(scoreOnServer) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy scoreOnServer = try scoreOnServer.getDecoder().decode(GameScore.self, from: encoded) } catch { XCTFail("Should have encoded/decoded: Error: \(error)") @@ -862,7 +862,7 @@ class ParseObjectTests: XCTestCase { // swiftlint:disable:this type_body_length let encoded: Data! do { encoded = try ParseCoding.jsonEncoder().encode(scoreOnServer) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy scoreOnServer = try scoreOnServer.getDecoder().decode(GameScore.self, from: encoded) } catch { XCTFail("Should have encoded/decoded: Error: \(error)") @@ -1003,7 +1003,7 @@ class ParseObjectTests: XCTestCase { // swiftlint:disable:this type_body_length XCTAssertNotNil(command.body) } - func testSave() { // swiftlint:disable:this function_body_length + func testSave() { let score = GameScore(points: 10) var scoreOnServer = score @@ -1013,7 +1013,7 @@ class ParseObjectTests: XCTestCase { // swiftlint:disable:this type_body_length let encoded: Data! do { encoded = try ParseCoding.jsonEncoder().encode(scoreOnServer) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy scoreOnServer = try scoreOnServer.getDecoder().decode(GameScore.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -1054,7 +1054,7 @@ class ParseObjectTests: XCTestCase { // swiftlint:disable:this type_body_length } } - func testSaveWithDefaultACL() throws { // swiftlint:disable:this function_body_length + func testSaveWithDefaultACL() throws { let user = try loginNormally() guard let userObjectId = user.objectId else { XCTFail("Should have objectId") @@ -1072,7 +1072,7 @@ class ParseObjectTests: XCTestCase { // swiftlint:disable:this type_body_length let encoded: Data! do { encoded = try ParseCoding.jsonEncoder().encode(scoreOnServer) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy scoreOnServer = try scoreOnServer.getDecoder().decode(GameScore.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -1114,7 +1114,7 @@ class ParseObjectTests: XCTestCase { // swiftlint:disable:this type_body_length let encoded: Data! do { encoded = try ParseCoding.jsonEncoder().encode(scoreOnServer) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy scoreOnServer = try scoreOnServer.getDecoder().decode(GameScore.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -1172,7 +1172,7 @@ class ParseObjectTests: XCTestCase { // swiftlint:disable:this type_body_length let encoded: Data! do { encoded = try ParseCoding.jsonEncoder().encode(scoreOnServer) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy scoreOnServer = try scoreOnServer.getDecoder().decode(GameScore.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -1199,7 +1199,6 @@ class ParseObjectTests: XCTestCase { // swiftlint:disable:this type_body_length } } - // swiftlint:disable:next function_body_length func saveAsync(score: GameScore, scoreOnServer: GameScore, callbackQueue: DispatchQueue) { let expectation1 = XCTestExpectation(description: "Save object1") @@ -1263,7 +1262,7 @@ class ParseObjectTests: XCTestCase { // swiftlint:disable:this type_body_length let encoded: Data! do { encoded = try ParseCoding.jsonEncoder().encode(scoreOnServer) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy scoreOnServer = try scoreOnServer.getDecoder().decode(GameScore.self, from: encoded) } catch { XCTFail("Should have encoded/decoded: Error: \(error)") @@ -1370,7 +1369,7 @@ class ParseObjectTests: XCTestCase { // swiftlint:disable:this type_body_length let encoded: Data! do { encoded = try ParseCoding.jsonEncoder().encode(scoreOnServer) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy scoreOnServer = try scoreOnServer.getDecoder().decode(GameScore.self, from: encoded) } catch { XCTFail("Should have encoded/decoded: Error: \(error)") @@ -1397,7 +1396,7 @@ class ParseObjectTests: XCTestCase { // swiftlint:disable:this type_body_length let encoded: Data! do { encoded = try ParseCoding.jsonEncoder().encode(scoreOnServer) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy scoreOnServer = try scoreOnServer.getDecoder().decode(GameScore.self, from: encoded) } catch { XCTFail("Should have encoded/decoded: Error: \(error)") @@ -1437,7 +1436,7 @@ class ParseObjectTests: XCTestCase { // swiftlint:disable:this type_body_length let encoded: Data! do { encoded = try GameScore.getEncoder().encode(scoreOnServer, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy scoreOnServer = try scoreOnServer.getDecoder().decode(GameScore.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -1537,7 +1536,7 @@ class ParseObjectTests: XCTestCase { // swiftlint:disable:this type_body_length let encoded: Data! do { encoded = try scoreOnServer.getEncoder().encode(scoreOnServer, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy scoreOnServer = try scoreOnServer.getDecoder().decode(GameScore.self, from: encoded) } catch { XCTFail("Should have encoded/decoded: Error: \(error)") @@ -1566,7 +1565,7 @@ class ParseObjectTests: XCTestCase { // swiftlint:disable:this type_body_length let encoded: Data! do { encoded = try scoreOnServer.getEncoder().encode(scoreOnServer, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy scoreOnServer = try scoreOnServer.getDecoder().decode(GameScore.self, from: encoded) } catch { XCTFail("Should have encoded/decoded: Error: \(error)") @@ -1640,7 +1639,7 @@ class ParseObjectTests: XCTestCase { // swiftlint:disable:this type_body_length let encoded: Data! do { encoded = try GameScore.getJSONEncoder().encode(response) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy let encodedScoreOnServer = try scoreOnServer.getEncoder().encode(scoreOnServer) scoreOnServer = try scoreOnServer.getDecoder().decode(GameScore.self, from: encodedScoreOnServer) } catch { @@ -1675,11 +1674,11 @@ class ParseObjectTests: XCTestCase { // swiftlint:disable:this type_body_length return } - //Saved updated info for game + // Saved updated info for game let encodedScore: Data do { encodedScore = try ParseCoding.jsonEncoder().encode(savedChild) - //Decode Pointer as GameScore + // Decode Pointer as GameScore game.gameScore = try game.getDecoder().decode(GameScore.self, from: encodedScore) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -1687,7 +1686,7 @@ class ParseObjectTests: XCTestCase { // swiftlint:disable:this type_body_length return } - //Setup ParseObject to return from mocker + // Setup ParseObject to return from mocker MockURLProtocol.removeAll() var gameOnServer = game @@ -1697,7 +1696,7 @@ class ParseObjectTests: XCTestCase { // swiftlint:disable:this type_body_length let encodedGamed: Data do { encodedGamed = try game.getEncoder().encode(gameOnServer, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy gameOnServer = try game.getDecoder().decode(Game.self, from: encodedGamed) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -1750,7 +1749,7 @@ class ParseObjectTests: XCTestCase { // swiftlint:disable:this type_body_length let encoded: Data! do { encoded = try GameScore.getJSONEncoder().encode(response) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy let encodedScoreOnServer = try scoreOnServer.getEncoder().encode(scoreOnServer) scoreOnServer = try scoreOnServer.getDecoder().decode(GameScore.self, from: encodedScoreOnServer) } catch { @@ -1785,11 +1784,11 @@ class ParseObjectTests: XCTestCase { // swiftlint:disable:this type_body_length return } - //Saved updated info for game + // Saved updated info for game let encodedScore: Data do { encodedScore = try ParseCoding.jsonEncoder().encode(savedChild) - //Decode Pointer as GameScore + // Decode Pointer as GameScore game.gameScore = try game.getDecoder().decode(GameScore.self, from: encodedScore) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -1797,7 +1796,7 @@ class ParseObjectTests: XCTestCase { // swiftlint:disable:this type_body_length return } - //Setup ParseObject to return from mocker + // Setup ParseObject to return from mocker MockURLProtocol.removeAll() var gameOnServer = game @@ -1807,7 +1806,7 @@ class ParseObjectTests: XCTestCase { // swiftlint:disable:this type_body_length let encodedGamed: Data do { encodedGamed = try game.getEncoder().encode(gameOnServer, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy gameOnServer = try game.getDecoder().decode(Game.self, from: encodedGamed) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -1924,7 +1923,7 @@ class ParseObjectTests: XCTestCase { // swiftlint:disable:this type_body_length } XCTAssertEqual(level.count, 1) XCTAssertEqual(level.first?.className, "Level") - XCTAssertEqual(level.first?.objectId, "yarr") //This is because mocker is only returning 1 response + XCTAssertEqual(level.first?.objectId, "yarr") // This is because mocker is only returning 1 response XCTAssertNil(parseError) expectation1.fulfill() } @@ -1966,7 +1965,7 @@ class ParseObjectTests: XCTestCase { // swiftlint:disable:this type_body_length do { let encoded = try score.getEncoder().encode(score, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy guard let scoreOnServer = try (score.getDecoder() .decode([String: AnyCodable].self, from: encoded))["levels"]?.value as? [[String: String]], @@ -2034,10 +2033,10 @@ class ParseObjectTests: XCTestCase { // swiftlint:disable:this type_body_length } XCTAssertNil(parseError) - //Saved updated info for game + // Saved updated info for game game.profilePicture = savedFile - //Setup ParseObject to return from mocker + // Setup ParseObject to return from mocker MockURLProtocol.removeAll() var gameOnServer = game @@ -2048,7 +2047,7 @@ class ParseObjectTests: XCTestCase { // swiftlint:disable:this type_body_length let encodedGamed: Data do { encodedGamed = try game.getEncoder().encode(gameOnServer, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy gameOnServer = try game.getDecoder().decode(Game2.self, from: encodedGamed) } catch { XCTFail("Should encode/decode. Error \(error)") diff --git a/Tests/ParseSwiftTests/ParseOperationAsyncTests.swift b/Tests/ParseSwiftTests/ParseOperationAsyncTests.swift index fd3220c6a..e3f4aa30a 100644 --- a/Tests/ParseSwiftTests/ParseOperationAsyncTests.swift +++ b/Tests/ParseSwiftTests/ParseOperationAsyncTests.swift @@ -14,7 +14,7 @@ import FoundationNetworking import XCTest @testable import ParseSwift -class ParseOperationAsyncTests: XCTestCase { // swiftlint:disable:this type_body_length +class ParseOperationAsyncTests: XCTestCase { struct GameScore: ParseObject { //: These are required by ParseObject var objectId: String? @@ -28,7 +28,7 @@ class ParseOperationAsyncTests: XCTestCase { // swiftlint:disable:this type_body var player: String? init() { } - //custom initializers + // custom initializers init (objectId: String?) { self.objectId = objectId } @@ -80,7 +80,7 @@ class ParseOperationAsyncTests: XCTestCase { // swiftlint:disable:this type_body let encoded: Data! do { encoded = try ParseCoding.jsonEncoder().encode(scoreOnServer) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy scoreOnServer = try scoreOnServer.getDecoder().decode(GameScore.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -159,7 +159,7 @@ class ParseOperationAsyncTests: XCTestCase { // swiftlint:disable:this type_body } @MainActor - func testSaveKeyPath() async throws { // swiftlint:disable:this function_body_length + func testSaveKeyPath() async throws { var score = GameScore() score.objectId = "yarr" let operations = try score.operation @@ -174,7 +174,7 @@ class ParseOperationAsyncTests: XCTestCase { // swiftlint:disable:this type_body let encoded: Data! do { encoded = try ParseCoding.jsonEncoder().encode(scoreOnServer) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy scoreOnServer = try scoreOnServer.getDecoder().decode(GameScore.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -194,7 +194,7 @@ class ParseOperationAsyncTests: XCTestCase { // swiftlint:disable:this type_body } @MainActor - func testSaveKeyPathOtherTypeOperationsExist() async throws { // swiftlint:disable:this function_body_length + func testSaveKeyPathOtherTypeOperationsExist() async throws { var score = GameScore() score.objectId = "yarr" let operations = try score.operation @@ -214,7 +214,7 @@ class ParseOperationAsyncTests: XCTestCase { // swiftlint:disable:this type_body } @MainActor - func testSaveKeyPathNilOperationsExist() async throws { // swiftlint:disable:this function_body_length + func testSaveKeyPathNilOperationsExist() async throws { var score = GameScore() score.objectId = "yarr" let operations = try score.operation diff --git a/Tests/ParseSwiftTests/ParseOperationCombineTests.swift b/Tests/ParseSwiftTests/ParseOperationCombineTests.swift index 243cbd947..cadbf80a2 100644 --- a/Tests/ParseSwiftTests/ParseOperationCombineTests.swift +++ b/Tests/ParseSwiftTests/ParseOperationCombineTests.swift @@ -13,7 +13,7 @@ import XCTest import Combine @testable import ParseSwift -class ParseOperationCombineTests: XCTestCase { // swiftlint:disable:this type_body_length +class ParseOperationCombineTests: XCTestCase { struct GameScore: ParseObject { //: These are required by ParseObject @@ -27,7 +27,7 @@ class ParseOperationCombineTests: XCTestCase { // swiftlint:disable:this type_bo var points: Int? var player: String? - //custom initializers + // custom initializers init() {} init (objectId: String?) { self.objectId = objectId @@ -81,7 +81,7 @@ class ParseOperationCombineTests: XCTestCase { // swiftlint:disable:this type_bo let encoded: Data! do { encoded = try ParseCoding.jsonEncoder().encode(scoreOnServer) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy scoreOnServer = try scoreOnServer.getDecoder().decode(GameScore.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") diff --git a/Tests/ParseSwiftTests/ParseOperationTests.swift b/Tests/ParseSwiftTests/ParseOperationTests.swift index 201496984..d373397c2 100644 --- a/Tests/ParseSwiftTests/ParseOperationTests.swift +++ b/Tests/ParseSwiftTests/ParseOperationTests.swift @@ -10,6 +10,8 @@ import Foundation import XCTest @testable import ParseSwift +// swiftlint:disable type_body_length + class ParseOperationTests: XCTestCase { struct GameScore: ParseObject { //: These are required by ParseObject @@ -52,7 +54,7 @@ class ParseOperationTests: XCTestCase { init() { } - //custom initializers + // custom initializers init(level: Int) { self.level = level self.members = [String]() @@ -107,7 +109,7 @@ class ParseOperationTests: XCTestCase { XCTAssertEqual(decoded, expected) } - func testSave() { // swiftlint:disable:this function_body_length + func testSave() { var score = GameScore() score.points = 10 score.objectId = "yarr" @@ -121,7 +123,7 @@ class ParseOperationTests: XCTestCase { let encoded: Data! do { encoded = try ParseCoding.jsonEncoder().encode(scoreOnServer) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy scoreOnServer = try scoreOnServer.getDecoder().decode(GameScore.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -169,7 +171,7 @@ class ParseOperationTests: XCTestCase { } } - func testSaveKeyPath() throws { // swiftlint:disable:this function_body_length + func testSaveKeyPath() throws { var score = GameScore() score.objectId = "yarr" let operations = try score.operation @@ -184,7 +186,7 @@ class ParseOperationTests: XCTestCase { let encoded: Data! do { encoded = try ParseCoding.jsonEncoder().encode(scoreOnServer) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy scoreOnServer = try scoreOnServer.getDecoder().decode(GameScore.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -203,7 +205,7 @@ class ParseOperationTests: XCTestCase { } } - func testSaveKeyPathOtherTypeOperationsExist() throws { // swiftlint:disable:this function_body_length + func testSaveKeyPathOtherTypeOperationsExist() throws { var score = GameScore() score.objectId = "yarr" let operations = try score.operation @@ -222,7 +224,7 @@ class ParseOperationTests: XCTestCase { } } - func testSaveKeyPathNilOperationsExist() throws { // swiftlint:disable:this function_body_length + func testSaveKeyPathNilOperationsExist() throws { var score = GameScore() score.objectId = "yarr" let operations = try score.operation @@ -256,7 +258,7 @@ class ParseOperationTests: XCTestCase { let encoded: Data! do { encoded = try ParseCoding.jsonEncoder().encode(scoreOnServer) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy scoreOnServer = try scoreOnServer.getDecoder().decode(GameScore.self, from: encoded) } catch { XCTFail("Should have encoded/decoded: Error: \(error)") @@ -296,7 +298,7 @@ class ParseOperationTests: XCTestCase { wait(for: [expectation1], timeout: 20.0) } - func testSaveSet() throws { // swiftlint:disable:this function_body_length + func testSaveSet() throws { var score = GameScore() score.points = 10 score.objectId = "yarr" @@ -310,7 +312,7 @@ class ParseOperationTests: XCTestCase { let encoded: Data! do { encoded = try ParseCoding.jsonEncoder().encode(scoreOnServer) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy scoreOnServer = try scoreOnServer.getDecoder().decode(GameScore.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -339,7 +341,7 @@ class ParseOperationTests: XCTestCase { } } - func testSaveSetToNull() throws { // swiftlint:disable:this function_body_length + func testSaveSetToNull() throws { var score = GameScore() score.points = 10 score.objectId = "yarr" @@ -353,7 +355,7 @@ class ParseOperationTests: XCTestCase { let encoded: Data! do { encoded = try ParseCoding.jsonEncoder().encode(scoreOnServer) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy scoreOnServer = try scoreOnServer.getDecoder().decode(GameScore.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -397,7 +399,7 @@ class ParseOperationTests: XCTestCase { let encoded: Data! do { encoded = try ParseCoding.jsonEncoder().encode(scoreOnServer) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy scoreOnServer = try scoreOnServer.getDecoder().decode(GameScore.self, from: encoded) } catch { XCTFail("Should have encoded/decoded: Error: \(error)") diff --git a/Tests/ParseSwiftTests/ParsePointerAsyncTests.swift b/Tests/ParseSwiftTests/ParsePointerAsyncTests.swift index f2c7d6147..09ecf9ff8 100644 --- a/Tests/ParseSwiftTests/ParsePointerAsyncTests.swift +++ b/Tests/ParseSwiftTests/ParsePointerAsyncTests.swift @@ -14,7 +14,7 @@ import FoundationNetworking import XCTest @testable import ParseSwift -class ParsePointerAsyncTests: XCTestCase { // swiftlint:disable:this type_body_length +class ParsePointerAsyncTests: XCTestCase { struct GameScore: ParseObject { //: These are required by ParseObject @@ -73,7 +73,7 @@ class ParsePointerAsyncTests: XCTestCase { // swiftlint:disable:this type_body_l let encoded: Data! do { encoded = try scoreOnServer.getEncoder().encode(scoreOnServer, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy scoreOnServer = try scoreOnServer.getDecoder().decode(GameScore.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") diff --git a/Tests/ParseSwiftTests/ParsePointerCombineTests.swift b/Tests/ParseSwiftTests/ParsePointerCombineTests.swift index d943e4865..db4381f46 100644 --- a/Tests/ParseSwiftTests/ParsePointerCombineTests.swift +++ b/Tests/ParseSwiftTests/ParsePointerCombineTests.swift @@ -73,7 +73,7 @@ class ParsePointerCombineTests: XCTestCase { let encoded: Data! do { encoded = try ParseCoding.jsonEncoder().encode(scoreOnServer) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy scoreOnServer = try scoreOnServer.getDecoder().decode(GameScore.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") diff --git a/Tests/ParseSwiftTests/ParsePointerTests.swift b/Tests/ParseSwiftTests/ParsePointerTests.swift index 18f9d7b12..43dc52029 100644 --- a/Tests/ParseSwiftTests/ParsePointerTests.swift +++ b/Tests/ParseSwiftTests/ParsePointerTests.swift @@ -10,6 +10,8 @@ import Foundation import XCTest @testable import ParseSwift +// swiftlint:disable type_body_length + class ParsePointerTests: XCTestCase { struct GameScore: ParseObject { @@ -161,7 +163,7 @@ class ParsePointerTests: XCTestCase { let encoded: Data! do { encoded = try scoreOnServer.getEncoder().encode(scoreOnServer, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy scoreOnServer = try scoreOnServer.getDecoder().decode(GameScore.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -321,7 +323,7 @@ class ParsePointerTests: XCTestCase { let encoded: Data! do { encoded = try scoreOnServer.getEncoder().encode(scoreOnServer, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy scoreOnServer = try scoreOnServer.getDecoder().decode(GameScore.self, from: encoded) } catch { XCTFail("Should have encoded/decoded: Error: \(error)") @@ -351,7 +353,7 @@ class ParsePointerTests: XCTestCase { let encoded: Data! do { encoded = try scoreOnServer.getEncoder().encode(scoreOnServer, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy scoreOnServer = try scoreOnServer.getDecoder().decode(GameScore.self, from: encoded) } catch { XCTFail("Should have encoded/decoded: Error: \(error)") diff --git a/Tests/ParseSwiftTests/ParsePushAsyncTests.swift b/Tests/ParseSwiftTests/ParsePushAsyncTests.swift index 1f6ded255..1ed1527a9 100644 --- a/Tests/ParseSwiftTests/ParsePushAsyncTests.swift +++ b/Tests/ParseSwiftTests/ParsePushAsyncTests.swift @@ -14,6 +14,8 @@ import FoundationNetworking import XCTest @testable import ParseSwift +// swiftlint:disable type_body_length + class ParsePushAsyncTests: XCTestCase { struct Installation: ParseInstallation { var installationId: String? diff --git a/Tests/ParseSwiftTests/ParsePushCombineTests.swift b/Tests/ParseSwiftTests/ParsePushCombineTests.swift index 3f2013671..ddd532f0b 100644 --- a/Tests/ParseSwiftTests/ParsePushCombineTests.swift +++ b/Tests/ParseSwiftTests/ParsePushCombineTests.swift @@ -13,6 +13,8 @@ import XCTest import Combine @testable import ParseSwift +// swiftlint:disable type_body_length + class ParsePushCombineTests: XCTestCase { struct Installation: ParseInstallation { var installationId: String? diff --git a/Tests/ParseSwiftTests/ParsePushPayloadAnyTests.swift b/Tests/ParseSwiftTests/ParsePushPayloadAnyTests.swift index e8d6b9fd6..c544bbb3d 100644 --- a/Tests/ParseSwiftTests/ParsePushPayloadAnyTests.swift +++ b/Tests/ParseSwiftTests/ParsePushPayloadAnyTests.swift @@ -10,7 +10,7 @@ import Foundation import XCTest @testable import ParseSwift -// swiftlint:disable line_length +// swiftlint:disable line_length function_body_length class ParsePushPayloadAnyTests: XCTestCase { diff --git a/Tests/ParseSwiftTests/ParseQueryAsyncTests.swift b/Tests/ParseSwiftTests/ParseQueryAsyncTests.swift index 11e003ede..23f213d7e 100644 --- a/Tests/ParseSwiftTests/ParseQueryAsyncTests.swift +++ b/Tests/ParseSwiftTests/ParseQueryAsyncTests.swift @@ -27,7 +27,7 @@ class ParseQueryAsyncTests: XCTestCase { // swiftlint:disable:this type_body_len var points: Int? var player: String? init() { } - //custom initializers + // custom initializers init (objectId: String?) { self.objectId = objectId } diff --git a/Tests/ParseSwiftTests/ParseQueryCombineTests.swift b/Tests/ParseSwiftTests/ParseQueryCombineTests.swift index 22c1e0527..7eccdb0e7 100644 --- a/Tests/ParseSwiftTests/ParseQueryCombineTests.swift +++ b/Tests/ParseSwiftTests/ParseQueryCombineTests.swift @@ -27,7 +27,7 @@ class ParseQueryCombineTests: XCTestCase { // swiftlint:disable:this type_body_l var points: Int? var player: String? - //custom initializers + // custom initializers init() {} init (objectId: String?) { diff --git a/Tests/ParseSwiftTests/ParseQueryTests.swift b/Tests/ParseSwiftTests/ParseQueryTests.swift index 6a43a6921..867e1246a 100644 --- a/Tests/ParseSwiftTests/ParseQueryTests.swift +++ b/Tests/ParseSwiftTests/ParseQueryTests.swift @@ -2873,7 +2873,6 @@ class ParseQueryTests: XCTestCase { // swiftlint:disable:this type_body_length } } - // swiftlint:disable:next function_body_length func testWhereKeyNearGeoBox() throws { let expected: [String: AnyCodable] = [ "yolo": ["$within": ["$box": [ @@ -2930,7 +2929,6 @@ class ParseQueryTests: XCTestCase { // swiftlint:disable:this type_body_length } #if !os(Linux) && !os(Android) && !os(Windows) - // swiftlint:disable:next function_body_length func testWhereKeyWithinPolygonPoints() throws { // swiftlint:disable:next line_length let expected = "{\"yolo\":{\"$geoWithin\":{\"$polygon\":[{\"__type\":\"GeoPoint\",\"latitude\":10.1,\"longitude\":20.100000000000001},{\"__type\":\"GeoPoint\",\"latitude\":20.100000000000001,\"longitude\":30.100000000000001},{\"__type\":\"GeoPoint\",\"latitude\":30.100000000000001,\"longitude\":40.100000000000001}]}}}" @@ -2943,7 +2941,6 @@ class ParseQueryTests: XCTestCase { // swiftlint:disable:this type_body_length XCTAssertEqual(query.where.description, expected) } - // swiftlint:disable:next function_body_length func testWhereKeyWithinPolygon() throws { // swiftlint:disable:next line_length let expected = "{\"yolo\":{\"$geoWithin\":{\"$polygon\":{\"__type\":\"Polygon\",\"coordinates\":[[20.100000000000001,10.1],[30.100000000000001,20.100000000000001],[40.100000000000001,30.100000000000001]]}}}}" diff --git a/Tests/ParseSwiftTests/ParseQueryViewModelTests.swift b/Tests/ParseSwiftTests/ParseQueryViewModelTests.swift index 6d35dda3b..5905af90d 100644 --- a/Tests/ParseSwiftTests/ParseQueryViewModelTests.swift +++ b/Tests/ParseSwiftTests/ParseQueryViewModelTests.swift @@ -11,6 +11,8 @@ import Foundation import XCTest @testable import ParseSwift +// swiftlint:disable type_body_length + class ParseQueryViewModelTests: XCTestCase { struct GameScore: ParseObject { //: These are required by ParseObject diff --git a/Tests/ParseSwiftTests/ParseRelationTests.swift b/Tests/ParseSwiftTests/ParseRelationTests.swift index 1b2c6fce2..38bbd8f3c 100644 --- a/Tests/ParseSwiftTests/ParseRelationTests.swift +++ b/Tests/ParseSwiftTests/ParseRelationTests.swift @@ -10,6 +10,8 @@ import Foundation import XCTest @testable import ParseSwift +// swiftlint:disable function_body_length type_body_length + class ParseRelationTests: XCTestCase { struct GameScore: ParseObject { //: These are required by ParseObject @@ -24,7 +26,7 @@ class ParseRelationTests: XCTestCase { var members = [String]() var levels: ParseRelation? - //custom initializers + // custom initializers init() { self.points = 5 } @@ -46,7 +48,7 @@ class ParseRelationTests: XCTestCase { var members = [String]() var levels: ParseRelation? - //custom initializers + // custom initializers init() { self.points = 5 } @@ -67,7 +69,7 @@ class ParseRelationTests: XCTestCase { var level: Int var members = [String]() - //custom initializers + // custom initializers init() { self.level = 5 } diff --git a/Tests/ParseSwiftTests/ParseRoleTests.swift b/Tests/ParseSwiftTests/ParseRoleTests.swift index 5205b4171..eafe9092c 100644 --- a/Tests/ParseSwiftTests/ParseRoleTests.swift +++ b/Tests/ParseSwiftTests/ParseRoleTests.swift @@ -10,6 +10,8 @@ import Foundation import XCTest @testable import ParseSwift +// swiftlint:disable type_body_length + class ParseRoleTests: XCTestCase { struct GameScore: ParseObject { //: These are required by ParseObject @@ -24,7 +26,7 @@ class ParseRoleTests: XCTestCase { var members = [String]() var levels: [String]? - //custom initializers + // custom initializers init() { self.points = 5 } @@ -91,7 +93,7 @@ class ParseRoleTests: XCTestCase { var level: Int var members = [String]() - //custom initializers + // custom initializers init() { self.level = 5 } @@ -458,7 +460,7 @@ class ParseRoleTests: XCTestCase { let encoded: Data! do { encoded = try ParseCoding.jsonEncoder().encode(serverResponse) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy serverResponse = try serverResponse.getDecoder().decode(Role.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -500,7 +502,7 @@ class ParseRoleTests: XCTestCase { let encoded: Data! do { encoded = try ParseCoding.jsonEncoder().encode(serverResponse) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy serverResponse = try serverResponse.getDecoder().decode(Role.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -575,7 +577,7 @@ class ParseRoleTests: XCTestCase { let encoded: Data! do { encoded = try ParseCoding.jsonEncoder().encode(serverResponse) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy serverResponse = try serverResponse.getDecoder().decode(Role.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -646,7 +648,7 @@ class ParseRoleTests: XCTestCase { let encoded: Data! do { encoded = try ParseCoding.jsonEncoder().encode(serverResponse) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy serverResponse = try serverResponse.getDecoder().decode(Role.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -734,7 +736,7 @@ class ParseRoleTests: XCTestCase { let encoded: Data! do { encoded = try ParseCoding.jsonEncoder().encode(serverResponse) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy serverResponse = try serverResponse.getDecoder().decode(Role.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") diff --git a/Tests/ParseSwiftTests/ParseSchemaTests.swift b/Tests/ParseSwiftTests/ParseSchemaTests.swift index 7b8804f96..d205c673d 100644 --- a/Tests/ParseSwiftTests/ParseSchemaTests.swift +++ b/Tests/ParseSwiftTests/ParseSchemaTests.swift @@ -10,6 +10,8 @@ import Foundation import XCTest @testable import ParseSwift +// swiftlint:disable function_body_length + class ParseSchemaTests: XCTestCase { // swiftlint:disable:this type_body_length struct GameScore: ParseObject { //: These are required by ParseObject diff --git a/Tests/ParseSwiftTests/ParseSessionTests.swift b/Tests/ParseSwiftTests/ParseSessionTests.swift index 651f3a50d..12af34c0a 100644 --- a/Tests/ParseSwiftTests/ParseSessionTests.swift +++ b/Tests/ParseSwiftTests/ParseSessionTests.swift @@ -86,7 +86,7 @@ class ParseSessionTests: XCTestCase { do { let command = try session.fetchCommand(include: nil) XCTAssertNotNil(command) - //Generates this component because fetchCommand is at the Objective protocol level + // Generates this component because fetchCommand is at the Objective protocol level XCTAssertEqual(command.path.urlComponent, "/classes/_Session/me") XCTAssertEqual(command.method, API.Method.GET) XCTAssertNil(command.params) diff --git a/Tests/ParseSwiftTests/ParseSpotifyAsyncTests.swift b/Tests/ParseSwiftTests/ParseSpotifyAsyncTests.swift index a7a21a72a..896953d3a 100644 --- a/Tests/ParseSwiftTests/ParseSpotifyAsyncTests.swift +++ b/Tests/ParseSwiftTests/ParseSpotifyAsyncTests.swift @@ -14,7 +14,7 @@ import FoundationNetworking import XCTest @testable import ParseSwift -class ParseSpotifyAsyncTests: XCTestCase { // swiftlint:disable:this type_body_length +class ParseSpotifyAsyncTests: XCTestCase { struct User: ParseUser { //: These are required by ParseObject @@ -103,7 +103,7 @@ class ParseSpotifyAsyncTests: XCTestCase { // swiftlint:disable:this type_body_l let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -138,7 +138,7 @@ class ParseSpotifyAsyncTests: XCTestCase { // swiftlint:disable:this type_body_l let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -184,7 +184,7 @@ class ParseSpotifyAsyncTests: XCTestCase { // swiftlint:disable:this type_body_l let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -216,7 +216,7 @@ class ParseSpotifyAsyncTests: XCTestCase { // swiftlint:disable:this type_body_l let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -255,7 +255,7 @@ class ParseSpotifyAsyncTests: XCTestCase { // swiftlint:disable:this type_body_l let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") diff --git a/Tests/ParseSwiftTests/ParseSpotifyCombineTests.swift b/Tests/ParseSwiftTests/ParseSpotifyCombineTests.swift index 5dfabbb16..656bc5c07 100644 --- a/Tests/ParseSwiftTests/ParseSpotifyCombineTests.swift +++ b/Tests/ParseSwiftTests/ParseSpotifyCombineTests.swift @@ -105,7 +105,7 @@ class ParseSpotifyCombineTests: XCTestCase { // swiftlint:disable:this type_body let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -155,7 +155,7 @@ class ParseSpotifyCombineTests: XCTestCase { // swiftlint:disable:this type_body let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -216,7 +216,7 @@ class ParseSpotifyCombineTests: XCTestCase { // swiftlint:disable:this type_body let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -263,7 +263,7 @@ class ParseSpotifyCombineTests: XCTestCase { // swiftlint:disable:this type_body let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -317,7 +317,7 @@ class ParseSpotifyCombineTests: XCTestCase { // swiftlint:disable:this type_body let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") diff --git a/Tests/ParseSwiftTests/ParseSpotifyTests.swift b/Tests/ParseSwiftTests/ParseSpotifyTests.swift index a1511f166..fe555d065 100644 --- a/Tests/ParseSwiftTests/ParseSpotifyTests.swift +++ b/Tests/ParseSwiftTests/ParseSpotifyTests.swift @@ -10,6 +10,8 @@ import Foundation import XCTest @testable import ParseSwift +// swiftlint:disable type_body_length + class ParseSpotifyTests: XCTestCase { struct User: ParseUser { @@ -148,7 +150,7 @@ class ParseSpotifyTests: XCTestCase { let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -170,7 +172,7 @@ class ParseSpotifyTests: XCTestCase { XCTAssertEqual(user.password, "world") XCTAssertTrue(user.spotify.isLinked) - //Test stripping + // Test stripping user.spotify.strip() XCTAssertFalse(user.spotify.isLinked) case .failure(let error): @@ -200,7 +202,7 @@ class ParseSpotifyTests: XCTestCase { let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -222,7 +224,7 @@ class ParseSpotifyTests: XCTestCase { XCTAssertEqual(user.password, "world") XCTAssertTrue(user.spotify.isLinked) - //Test stripping + // Test stripping user.spotify.strip() XCTAssertFalse(user.spotify.isLinked) case .failure(let error): @@ -269,7 +271,7 @@ class ParseSpotifyTests: XCTestCase { let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -310,7 +312,7 @@ class ParseSpotifyTests: XCTestCase { let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -351,7 +353,7 @@ class ParseSpotifyTests: XCTestCase { let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -394,7 +396,7 @@ class ParseSpotifyTests: XCTestCase { let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -438,7 +440,7 @@ class ParseSpotifyTests: XCTestCase { let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -509,7 +511,7 @@ class ParseSpotifyTests: XCTestCase { let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") diff --git a/Tests/ParseSwiftTests/ParseTwitterAsyncTests.swift b/Tests/ParseSwiftTests/ParseTwitterAsyncTests.swift index b246a4336..b3b58504e 100644 --- a/Tests/ParseSwiftTests/ParseTwitterAsyncTests.swift +++ b/Tests/ParseSwiftTests/ParseTwitterAsyncTests.swift @@ -14,7 +14,7 @@ import FoundationNetworking import XCTest @testable import ParseSwift -class ParseTwitterAsyncTests: XCTestCase { // swiftlint:disable:this type_body_length +class ParseTwitterAsyncTests: XCTestCase { struct User: ParseUser { //: These are required by ParseObject @@ -104,7 +104,7 @@ class ParseTwitterAsyncTests: XCTestCase { // swiftlint:disable:this type_body_l let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -142,7 +142,7 @@ class ParseTwitterAsyncTests: XCTestCase { // swiftlint:disable:this type_body_l let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -196,7 +196,7 @@ class ParseTwitterAsyncTests: XCTestCase { // swiftlint:disable:this type_body_l let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -234,7 +234,7 @@ class ParseTwitterAsyncTests: XCTestCase { // swiftlint:disable:this type_body_l let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -284,7 +284,7 @@ class ParseTwitterAsyncTests: XCTestCase { // swiftlint:disable:this type_body_l let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") diff --git a/Tests/ParseSwiftTests/ParseTwitterCombineTests.swift b/Tests/ParseSwiftTests/ParseTwitterCombineTests.swift index 69e1295a5..34357f9aa 100644 --- a/Tests/ParseSwiftTests/ParseTwitterCombineTests.swift +++ b/Tests/ParseSwiftTests/ParseTwitterCombineTests.swift @@ -105,7 +105,7 @@ class ParseTwitterCombineTests: XCTestCase { // swiftlint:disable:this type_body let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -157,7 +157,7 @@ class ParseTwitterCombineTests: XCTestCase { // swiftlint:disable:this type_body let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -225,7 +225,7 @@ class ParseTwitterCombineTests: XCTestCase { // swiftlint:disable:this type_body let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -277,7 +277,7 @@ class ParseTwitterCombineTests: XCTestCase { // swiftlint:disable:this type_body let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -341,7 +341,7 @@ class ParseTwitterCombineTests: XCTestCase { // swiftlint:disable:this type_body let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") diff --git a/Tests/ParseSwiftTests/ParseTwitterTests.swift b/Tests/ParseSwiftTests/ParseTwitterTests.swift index 248a5a83e..11d1e8efa 100644 --- a/Tests/ParseSwiftTests/ParseTwitterTests.swift +++ b/Tests/ParseSwiftTests/ParseTwitterTests.swift @@ -10,6 +10,8 @@ import Foundation import XCTest @testable import ParseSwift +// swiftlint:disable type_body_length + class ParseTwitterTests: XCTestCase { struct User: ParseUser { @@ -156,7 +158,7 @@ class ParseTwitterTests: XCTestCase { let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -180,7 +182,7 @@ class ParseTwitterTests: XCTestCase { XCTAssertEqual(user.password, "world") XCTAssertTrue(user.twitter.isLinked) - //Test stripping + // Test stripping user.twitter.strip() XCTAssertFalse(user.twitter.isLinked) case .failure(let error): @@ -214,7 +216,7 @@ class ParseTwitterTests: XCTestCase { let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -235,7 +237,7 @@ class ParseTwitterTests: XCTestCase { XCTAssertEqual(user.password, "world") XCTAssertTrue(user.twitter.isLinked) - //Test stripping + // Test stripping user.twitter.strip() XCTAssertFalse(user.twitter.isLinked) case .failure(let error): @@ -282,7 +284,7 @@ class ParseTwitterTests: XCTestCase { let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -326,7 +328,7 @@ class ParseTwitterTests: XCTestCase { let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -369,7 +371,7 @@ class ParseTwitterTests: XCTestCase { let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -414,7 +416,7 @@ class ParseTwitterTests: XCTestCase { let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -460,7 +462,7 @@ class ParseTwitterTests: XCTestCase { let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -538,7 +540,7 @@ class ParseTwitterTests: XCTestCase { let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") diff --git a/Tests/ParseSwiftTests/ParseUserAsyncTests.swift b/Tests/ParseSwiftTests/ParseUserAsyncTests.swift index dfa54a82b..0d527055c 100644 --- a/Tests/ParseSwiftTests/ParseUserAsyncTests.swift +++ b/Tests/ParseSwiftTests/ParseUserAsyncTests.swift @@ -14,6 +14,8 @@ import FoundationNetworking import XCTest @testable import ParseSwift +// swiftlint:disable function_body_length + class ParseUserAsyncTests: XCTestCase { // swiftlint:disable:this type_body_length struct User: ParseUser { @@ -1010,7 +1012,7 @@ class ParseUserAsyncTests: XCTestCase { // swiftlint:disable:this type_body_leng let encoded: Data! do { encoded = try originalResponse.getEncoder().encode(originalResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy originalResponse = try originalResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -1078,7 +1080,7 @@ class ParseUserAsyncTests: XCTestCase { // swiftlint:disable:this type_body_leng let encoded: Data! do { encoded = try originalResponse.getEncoder().encode(originalResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy originalResponse = try originalResponse.getDecoder().decode(UserDefault.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -1208,7 +1210,7 @@ class ParseUserAsyncTests: XCTestCase { // swiftlint:disable:this type_body_leng let encoded: Data! do { encoded = try ParseCoding.jsonEncoder().encode(userOnServer) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy let encoded1 = try ParseCoding.jsonEncoder().encode(user) user = try user.getDecoder().decode(User.self, from: encoded1) } catch { @@ -1243,7 +1245,7 @@ class ParseUserAsyncTests: XCTestCase { // swiftlint:disable:this type_body_leng XCTAssertEqual(fetchedUpdatedAt, serverUpdatedAt) XCTAssertEqual(User.current?.customKey, user.customKey) - //Should be updated in memory + // Should be updated in memory guard let updatedCurrentDate = User.current?.updatedAt else { XCTFail("Should unwrap current date") expectation1.fulfill() @@ -1252,7 +1254,7 @@ class ParseUserAsyncTests: XCTestCase { // swiftlint:disable:this type_body_leng XCTAssertEqual(updatedCurrentDate, serverUpdatedAt) #if !os(Linux) && !os(Android) && !os(Windows) - //Should be updated in Keychain + // Should be updated in Keychain guard let keychainUser: CurrentUserContainer = try? KeychainStore.shared.get(valueFor: ParseStorage.Keys.currentUser), let keychainUpdatedCurrentDate = keychainUser.currentUser?.updatedAt else { @@ -1285,7 +1287,7 @@ class ParseUserAsyncTests: XCTestCase { // swiftlint:disable:this type_body_leng let encoded: Data! do { encoded = try ParseCoding.jsonEncoder().encode(userOnServer) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy let encoded1 = try ParseCoding.jsonEncoder().encode(user) user = try user.getDecoder().decode(User.self, from: encoded1) } catch { @@ -1314,7 +1316,7 @@ class ParseUserAsyncTests: XCTestCase { // swiftlint:disable:this type_body_leng XCTAssertEqual(savedUpdatedAt, serverUpdatedAt) XCTAssertEqual(User.current?.customKey, user.customKey) - //Should be updated in memory + // Should be updated in memory guard let updatedCurrentDate = User.current?.updatedAt else { XCTFail("Should unwrap current date") return @@ -1322,7 +1324,7 @@ class ParseUserAsyncTests: XCTestCase { // swiftlint:disable:this type_body_leng XCTAssertEqual(updatedCurrentDate, serverUpdatedAt) #if !os(Linux) && !os(Android) && !os(Windows) - //Should be updated in Keychain + // Should be updated in Keychain guard let keychainUser: CurrentUserContainer = try? KeychainStore.shared.get(valueFor: ParseStorage.Keys.currentUser), let keychainUpdatedCurrentDate = keychainUser.currentUser?.updatedAt else { @@ -1354,7 +1356,7 @@ class ParseUserAsyncTests: XCTestCase { // swiftlint:disable:this type_body_leng let encoded: Data! do { encoded = try ParseCoding.jsonEncoder().encode(serverResponse) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy let encoded1 = try ParseCoding.jsonEncoder().encode(userOnServer) userOnServer = try userOnServer.getDecoder().decode(User.self, from: encoded1) } catch { @@ -1405,7 +1407,7 @@ class ParseUserAsyncTests: XCTestCase { // swiftlint:disable:this type_body_leng let encoded: Data! do { encoded = try ParseCoding.jsonEncoder().encode(serverResponse) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy let encoded1 = try ParseCoding.jsonEncoder().encode(userOnServer) userOnServer = try userOnServer.getDecoder().decode(User.self, from: encoded1) } catch { @@ -1448,7 +1450,7 @@ class ParseUserAsyncTests: XCTestCase { // swiftlint:disable:this type_body_leng let encoded: Data! do { encoded = try ParseCoding.jsonEncoder().encode(serverResponse) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy let encoded1 = try ParseCoding.jsonEncoder().encode(userOnServer) userOnServer = try userOnServer.getDecoder().decode(User.self, from: encoded1) } catch { @@ -1498,7 +1500,7 @@ class ParseUserAsyncTests: XCTestCase { // swiftlint:disable:this type_body_leng let encoded: Data! do { encoded = try ParseCoding.jsonEncoder().encode(serverResponse) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy let encoded1 = try ParseCoding.jsonEncoder().encode(userOnServer) userOnServer = try userOnServer.getDecoder().decode(User.self, from: encoded1) } catch { diff --git a/Tests/ParseSwiftTests/ParseUserCombineTests.swift b/Tests/ParseSwiftTests/ParseUserCombineTests.swift index de4ec5176..6424c6f5e 100644 --- a/Tests/ParseSwiftTests/ParseUserCombineTests.swift +++ b/Tests/ParseSwiftTests/ParseUserCombineTests.swift @@ -13,6 +13,8 @@ import XCTest import Combine @testable import ParseSwift +// swiftlint:disable function_body_length + class ParseUserCombineTests: XCTestCase { // swiftlint:disable:this type_body_length struct User: ParseUser { @@ -905,7 +907,7 @@ class ParseUserCombineTests: XCTestCase { // swiftlint:disable:this type_body_le let encoded: Data! do { encoded = try ParseCoding.jsonEncoder().encode(userOnServer) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy let encoded1 = try ParseCoding.jsonEncoder().encode(user) user = try user.getDecoder().decode(User.self, from: encoded1) } catch { @@ -949,7 +951,7 @@ class ParseUserCombineTests: XCTestCase { // swiftlint:disable:this type_body_le XCTAssertEqual(fetchedUpdatedAt, serverUpdatedAt) XCTAssertEqual(User.current?.customKey, user.customKey) - //Should be updated in memory + // Should be updated in memory guard let updatedCurrentDate = User.current?.updatedAt else { XCTFail("Should unwrap current date") expectation1.fulfill() @@ -958,7 +960,7 @@ class ParseUserCombineTests: XCTestCase { // swiftlint:disable:this type_body_le XCTAssertEqual(updatedCurrentDate, serverUpdatedAt) #if !os(Linux) && !os(Android) && !os(Windows) - //Should be updated in Keychain + // Should be updated in Keychain guard let keychainUser: CurrentUserContainer = try? KeychainStore.shared.get(valueFor: ParseStorage.Keys.currentUser), let keychainUpdatedCurrentDate = keychainUser.currentUser?.updatedAt else { @@ -997,7 +999,7 @@ class ParseUserCombineTests: XCTestCase { // swiftlint:disable:this type_body_le let encoded: Data! do { encoded = try ParseCoding.jsonEncoder().encode(userOnServer) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy let encoded1 = try ParseCoding.jsonEncoder().encode(user) user = try user.getDecoder().decode(User.self, from: encoded1) } catch { @@ -1036,7 +1038,7 @@ class ParseUserCombineTests: XCTestCase { // swiftlint:disable:this type_body_le XCTAssertEqual(savedUpdatedAt, originalUpdatedAt) XCTAssertEqual(User.current?.customKey, user.customKey) - //Should be updated in memory + // Should be updated in memory guard let updatedCurrentDate = User.current?.updatedAt else { XCTFail("Should unwrap current date") expectation1.fulfill() @@ -1045,7 +1047,7 @@ class ParseUserCombineTests: XCTestCase { // swiftlint:disable:this type_body_le XCTAssertEqual(updatedCurrentDate, originalUpdatedAt) #if !os(Linux) && !os(Android) && !os(Windows) - //Should be updated in Keychain + // Should be updated in Keychain guard let keychainUser: CurrentUserContainer = try? KeychainStore.shared.get(valueFor: ParseStorage.Keys.currentUser), let keychainUpdatedCurrentDate = keychainUser.currentUser?.updatedAt else { @@ -1082,7 +1084,7 @@ class ParseUserCombineTests: XCTestCase { // swiftlint:disable:this type_body_le let encoded: Data! do { encoded = try ParseCoding.jsonEncoder().encode(userOnServer) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy let encoded1 = try ParseCoding.jsonEncoder().encode(serverResponse) serverResponse = try user.getDecoder().decode(User.self, from: encoded1) } catch { @@ -1149,7 +1151,7 @@ class ParseUserCombineTests: XCTestCase { // swiftlint:disable:this type_body_le let encoded: Data! do { encoded = try ParseCoding.jsonEncoder().encode(userOnServer) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy let encoded1 = try ParseCoding.jsonEncoder().encode(serverResponse) serverResponse = try user.getDecoder().decode(User.self, from: encoded1) } catch { @@ -1205,7 +1207,7 @@ class ParseUserCombineTests: XCTestCase { // swiftlint:disable:this type_body_le let encoded: Data! do { encoded = try ParseCoding.jsonEncoder().encode(userOnServer) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy let encoded1 = try ParseCoding.jsonEncoder().encode(serverResponse) serverResponse = try user.getDecoder().decode(User.self, from: encoded1) } catch { @@ -1270,7 +1272,7 @@ class ParseUserCombineTests: XCTestCase { // swiftlint:disable:this type_body_le let encoded: Data! do { encoded = try ParseCoding.jsonEncoder().encode(userOnServer) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy let encoded1 = try ParseCoding.jsonEncoder().encode(serverResponse) serverResponse = try user.getDecoder().decode(User.self, from: encoded1) } catch { diff --git a/Tests/ParseSwiftTests/ParseUserTests.swift b/Tests/ParseSwiftTests/ParseUserTests.swift index bbdee2a94..3621bc75f 100644 --- a/Tests/ParseSwiftTests/ParseUserTests.swift +++ b/Tests/ParseSwiftTests/ParseUserTests.swift @@ -294,7 +294,7 @@ class ParseUserTests: XCTestCase { // swiftlint:disable:this type_body_length let encoded: Data! do { encoded = try userOnServer.getEncoder().encode(userOnServer, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try userOnServer.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -363,7 +363,7 @@ class ParseUserTests: XCTestCase { // swiftlint:disable:this type_body_length let encoded: Data! do { encoded = try userOnServer.getEncoder().encode(userOnServer, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try userOnServer.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -391,11 +391,11 @@ class ParseUserTests: XCTestCase { // swiftlint:disable:this type_body_length XCTAssertNil(fetched.ACL) XCTAssertEqual(fetched.customKey, userOnServer.customKey) - //Should be updated in memory + // Should be updated in memory XCTAssertEqual(User.current?.updatedAt, fetchedUpdatedAt) XCTAssertEqual(User.current?.customKey, userOnServer.customKey) - //Should be updated in Keychain + // Should be updated in Keychain #if !os(Linux) && !os(Android) && !os(Windows) guard let keychainUser: CurrentUserContainer = try? KeychainStore.shared.get(valueFor: ParseStorage.Keys.currentUser) else { @@ -429,7 +429,7 @@ class ParseUserTests: XCTestCase { // swiftlint:disable:this type_body_length let encoded: Data! do { encoded = try userOnServer.getEncoder().encode(userOnServer, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try userOnServer.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -462,11 +462,11 @@ class ParseUserTests: XCTestCase { // swiftlint:disable:this type_body_length XCTAssertNil(fetched.ACL) XCTAssertEqual(User.current?.customKey, userOnServer.customKey) - //Should be updated in memory + // Should be updated in memory XCTAssertEqual(User.current?.updatedAt, fetchedUpdatedAt) #if !os(Linux) && !os(Android) && !os(Windows) - //Should be updated in Keychain + // Should be updated in Keychain guard let keychainUser: CurrentUserContainer = try? KeychainStore.shared.get(valueFor: ParseStorage.Keys.currentUser) else { XCTFail("Should get object from Keychain") @@ -557,7 +557,7 @@ class ParseUserTests: XCTestCase { // swiftlint:disable:this type_body_length let encoded: Data! do { encoded = try userOnServer.getEncoder().encode(userOnServer, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try userOnServer.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -753,7 +753,7 @@ class ParseUserTests: XCTestCase { // swiftlint:disable:this type_body_length } #endif - func testSaveAndUpdateCurrentUser() throws { // swiftlint:disable:this function_body_length + func testSaveAndUpdateCurrentUser() throws { XCTAssertNil(User.current?.objectId) try userSignUp() XCTAssertNotNil(User.current?.objectId) @@ -770,7 +770,7 @@ class ParseUserTests: XCTestCase { // swiftlint:disable:this type_body_length let encoded: Data! do { encoded = try userOnServer.getEncoder().encode(userOnServer, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try userOnServer.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -793,12 +793,12 @@ class ParseUserTests: XCTestCase { // swiftlint:disable:this type_body_length XCTAssertEqual(savedUpdatedAt, userOnServer.updatedAt) XCTAssertNil(saved.ACL) - //Should be updated in memory + // Should be updated in memory XCTAssertEqual(User.current?.updatedAt, savedUpdatedAt) XCTAssertEqual(User.current?.email, user.email) #if !os(Linux) && !os(Android) && !os(Windows) - //Should be updated in Keychain + // Should be updated in Keychain guard let keychainUser: CurrentUserContainer = try? KeychainStore.shared.get(valueFor: ParseStorage.Keys.currentUser) else { XCTFail("Should get object from Keychain") @@ -813,7 +813,7 @@ class ParseUserTests: XCTestCase { // swiftlint:disable:this type_body_length } } - func testSaveAndUpdateCurrentUserModifiedEmail() throws { // swiftlint:disable:this function_body_length + func testSaveAndUpdateCurrentUserModifiedEmail() throws { XCTAssertNil(User.current?.objectId) try userSignUp() XCTAssertNotNil(User.current?.objectId) @@ -831,7 +831,7 @@ class ParseUserTests: XCTestCase { // swiftlint:disable:this type_body_length let encoded: Data! do { encoded = try userOnServer.getEncoder().encode(userOnServer, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try userOnServer.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -854,12 +854,12 @@ class ParseUserTests: XCTestCase { // swiftlint:disable:this type_body_length XCTAssertEqual(savedUpdatedAt, userOnServer.updatedAt) XCTAssertNil(saved.ACL) - //Should be updated in memory + // Should be updated in memory XCTAssertEqual(User.current?.updatedAt, savedUpdatedAt) XCTAssertEqual(User.current?.email, user.email) #if !os(Linux) && !os(Android) && !os(Windows) - //Should be updated in Keychain + // Should be updated in Keychain guard let keychainUser: CurrentUserContainer = try? KeychainStore.shared.get(valueFor: ParseStorage.Keys.currentUser) else { XCTFail("Should get object from Keychain") @@ -874,6 +874,7 @@ class ParseUserTests: XCTestCase { // swiftlint:disable:this type_body_length } } + // swiftlint:disable:next function_body_length func testSaveMutableMergeCurrentUser() throws { // Signup current User XCTAssertNil(User.current?.objectId) @@ -891,7 +892,7 @@ class ParseUserTests: XCTestCase { // swiftlint:disable:this type_body_length let encoded: Data! do { encoded = try response.getEncoder().encode(response, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy response = try response.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -957,7 +958,7 @@ class ParseUserTests: XCTestCase { // swiftlint:disable:this type_body_length let encoded: Data! do { encoded = try userOnServer.getEncoder().encode(userOnServer, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try userOnServer.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -984,12 +985,12 @@ class ParseUserTests: XCTestCase { // swiftlint:disable:this type_body_length XCTAssertEqual(savedUpdatedAt, userOnServer.updatedAt) XCTAssertNil(saved.ACL) - //Should be updated in memory + // Should be updated in memory XCTAssertEqual(User.current?.updatedAt, savedUpdatedAt) XCTAssertEqual(User.current?.email, user.email) #if !os(Linux) && !os(Android) && !os(Windows) - //Should be updated in Keychain + // Should be updated in Keychain guard let keychainUser: CurrentUserContainer = try? KeychainStore.shared.get(valueFor: ParseStorage.Keys.currentUser) else { XCTFail("Should get object from Keychain") @@ -1025,7 +1026,7 @@ class ParseUserTests: XCTestCase { // swiftlint:disable:this type_body_length let encoded: Data! do { encoded = try userOnServer.getEncoder().encode(userOnServer, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try userOnServer.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -1052,12 +1053,12 @@ class ParseUserTests: XCTestCase { // swiftlint:disable:this type_body_length XCTAssertEqual(savedUpdatedAt, userOnServer.updatedAt) XCTAssertNil(saved.ACL) - //Should be updated in memory + // Should be updated in memory XCTAssertEqual(User.current?.updatedAt, savedUpdatedAt) XCTAssertEqual(User.current?.email, user.email) #if !os(Linux) && !os(Android) && !os(Windows) - //Should be updated in Keychain + // Should be updated in Keychain guard let keychainUser: CurrentUserContainer = try? KeychainStore.shared.get(valueFor: ParseStorage.Keys.currentUser) else { XCTFail("Should get object from Keychain") @@ -1075,7 +1076,7 @@ class ParseUserTests: XCTestCase { // swiftlint:disable:this type_body_length wait(for: [expectation1], timeout: 20.0) } - func testUpdate() { // swiftlint:disable:this function_body_length + func testUpdate() { var user = User() let objectId = "yarr" user.objectId = objectId @@ -1088,7 +1089,7 @@ class ParseUserTests: XCTestCase { // swiftlint:disable:this type_body_length let encoded: Data! do { encoded = try userOnServer.getEncoder().encode(userOnServer, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try userOnServer.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -1130,7 +1131,7 @@ class ParseUserTests: XCTestCase { // swiftlint:disable:this type_body_length } } - func testSaveWithDefaultACL() throws { // swiftlint:disable:this function_body_length + func testSaveWithDefaultACL() throws { try userSignUp() guard let userObjectId = User.current?.objectId else { XCTFail("Should have objectId") @@ -1147,7 +1148,7 @@ class ParseUserTests: XCTestCase { // swiftlint:disable:this type_body_length let encoded: Data! do { encoded = try userOnServer.getEncoder().encode(userOnServer, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try userOnServer.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -1181,7 +1182,7 @@ class ParseUserTests: XCTestCase { // swiftlint:disable:this type_body_length } } - func testUpdateWithDefaultACL() throws { // swiftlint:disable:this function_body_length + func testUpdateWithDefaultACL() throws { try userSignUp() _ = try ParseACL.setDefaultACL(ParseACL(), withAccessForCurrentUser: true) @@ -1197,7 +1198,7 @@ class ParseUserTests: XCTestCase { // swiftlint:disable:this type_body_length let encoded: Data! do { encoded = try userOnServer.getEncoder().encode(userOnServer, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try userOnServer.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -1292,7 +1293,7 @@ class ParseUserTests: XCTestCase { // swiftlint:disable:this type_body_length let encoded: Data! do { encoded = try userOnServer.getEncoder().encode(userOnServer, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try userOnServer.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -1319,7 +1320,7 @@ class ParseUserTests: XCTestCase { // swiftlint:disable:this type_body_length let encoded: Data! do { encoded = try userOnServer.getEncoder().encode(userOnServer, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try userOnServer.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -2123,7 +2124,7 @@ class ParseUserTests: XCTestCase { // swiftlint:disable:this type_body_length let encoded: Data! do { encoded = try userOnServer.getEncoder().encode(userOnServer, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try userOnServer.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -2161,7 +2162,7 @@ class ParseUserTests: XCTestCase { // swiftlint:disable:this type_body_length let encoded: Data! do { encoded = try ParseCoding.jsonEncoder().encode(userOnServer) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy let encoded1 = try ParseCoding.jsonEncoder().encode(user) user = try user.getDecoder().decode(User.self, from: encoded1) } catch { @@ -2194,7 +2195,7 @@ class ParseUserTests: XCTestCase { // swiftlint:disable:this type_body_length XCTAssertEqual(fetchedUpdatedAt, serverUpdatedAt) XCTAssertEqual(User.current?.customKey, user.customKey) - //Should be updated in memory + // Should be updated in memory guard let updatedCurrentDate = User.current?.updatedAt else { XCTFail("Should unwrap current date") return @@ -2202,7 +2203,7 @@ class ParseUserTests: XCTestCase { // swiftlint:disable:this type_body_length XCTAssertEqual(updatedCurrentDate, serverUpdatedAt) #if !os(Linux) && !os(Android) && !os(Windows) - //Should be updated in Keychain + // Should be updated in Keychain guard let keychainUser: CurrentUserContainer = try? KeychainStore.shared.get(valueFor: ParseStorage.Keys.currentUser), let keychainUpdatedCurrentDate = keychainUser.currentUser?.updatedAt else { @@ -2239,7 +2240,7 @@ class ParseUserTests: XCTestCase { // swiftlint:disable:this type_body_length let encoded: Data! do { encoded = try ParseCoding.jsonEncoder().encode(userOnServer) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy let encoded1 = try ParseCoding.jsonEncoder().encode(user) user = try user.getDecoder().decode(User.self, from: encoded1) } catch { @@ -2277,7 +2278,7 @@ class ParseUserTests: XCTestCase { // swiftlint:disable:this type_body_length XCTAssertEqual(fetchedUpdatedAt, serverUpdatedAt) XCTAssertEqual(User.current?.customKey, user.customKey) - //Should be updated in memory + // Should be updated in memory guard let updatedCurrentDate = User.current?.updatedAt else { XCTFail("Should unwrap current date") expectation1.fulfill() @@ -2286,7 +2287,7 @@ class ParseUserTests: XCTestCase { // swiftlint:disable:this type_body_length XCTAssertEqual(updatedCurrentDate, serverUpdatedAt) #if !os(Linux) && !os(Android) && !os(Windows) - //Should be updated in Keychain + // Should be updated in Keychain guard let keychainUser: CurrentUserContainer = try? KeychainStore.shared.get(valueFor: ParseStorage.Keys.currentUser), let keychainUpdatedCurrentDate = keychainUser.currentUser?.updatedAt else { @@ -2309,7 +2310,7 @@ class ParseUserTests: XCTestCase { // swiftlint:disable:this type_body_length wait(for: [expectation1], timeout: 20.0) } - // swiftlint:disable:next function_body_length + // swiftlint:disable:next function_body_length cyclomatic_complexity func testSaveAllCurrent() { testLogin() MockURLProtocol.removeAll() @@ -2329,7 +2330,7 @@ class ParseUserTests: XCTestCase { // swiftlint:disable:this type_body_length let encoded: Data! do { encoded = try ParseCoding.jsonEncoder().encode(userOnServer) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy let encoded1 = try ParseCoding.jsonEncoder().encode(user) user = try user.getDecoder().decode(User.self, from: encoded1) } catch { @@ -2357,7 +2358,7 @@ class ParseUserTests: XCTestCase { // swiftlint:disable:this type_body_length XCTAssertEqual(savedUpdatedAt, originalUpdatedAt) XCTAssertEqual(User.current?.customKey, user.customKey) - //Should be updated in memory + // Should be updated in memory guard let updatedCurrentDate = User.current?.updatedAt else { XCTFail("Should unwrap current date") return @@ -2365,7 +2366,7 @@ class ParseUserTests: XCTestCase { // swiftlint:disable:this type_body_length XCTAssertEqual(updatedCurrentDate, originalUpdatedAt) #if !os(Linux) && !os(Android) && !os(Windows) - //Should be updated in Keychain + // Should be updated in Keychain guard let keychainUser: CurrentUserContainer = try? KeychainStore.shared.get(valueFor: ParseStorage.Keys.currentUser), let keychainUpdatedCurrentDate = keychainUser.currentUser?.updatedAt else { @@ -2399,7 +2400,7 @@ class ParseUserTests: XCTestCase { // swiftlint:disable:this type_body_length XCTAssertEqual(savedUpdatedAt, originalUpdatedAt) XCTAssertEqual(User.current?.customKey, user.customKey) - //Should be updated in memory + // Should be updated in memory guard let updatedCurrentDate = User.current?.updatedAt else { XCTFail("Should unwrap current date") return @@ -2407,7 +2408,7 @@ class ParseUserTests: XCTestCase { // swiftlint:disable:this type_body_length XCTAssertEqual(updatedCurrentDate, originalUpdatedAt) #if !os(Linux) && !os(Android) && !os(Windows) - //Should be updated in Keychain + // Should be updated in Keychain guard let keychainUser: CurrentUserContainer = try? KeychainStore.shared.get(valueFor: ParseStorage.Keys.currentUser), let keychainUpdatedCurrentDate = keychainUser.currentUser?.updatedAt else { @@ -2425,7 +2426,7 @@ class ParseUserTests: XCTestCase { // swiftlint:disable:this type_body_length } } - // swiftlint:disable:next function_body_length + // swiftlint:disable:next function_body_length cyclomatic_complexity func testSaveAllAsyncMainQueueCurrent() { testLogin() MockURLProtocol.removeAll() @@ -2450,7 +2451,7 @@ class ParseUserTests: XCTestCase { // swiftlint:disable:this type_body_length let encoded: Data! do { encoded = try ParseCoding.jsonEncoder().encode(userOnServer) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy let encoded1 = try ParseCoding.jsonEncoder().encode(user) user = try user.getDecoder().decode(User.self, from: encoded1) } catch { @@ -2484,7 +2485,7 @@ class ParseUserTests: XCTestCase { // swiftlint:disable:this type_body_length XCTAssertEqual(savedUpdatedAt, originalUpdatedAt) XCTAssertEqual(User.current?.customKey, user.customKey) - //Should be updated in memory + // Should be updated in memory guard let updatedCurrentDate = User.current?.updatedAt else { XCTFail("Should unwrap current date") expectation1.fulfill() @@ -2493,7 +2494,7 @@ class ParseUserTests: XCTestCase { // swiftlint:disable:this type_body_length XCTAssertEqual(updatedCurrentDate, originalUpdatedAt) #if !os(Linux) && !os(Android) && !os(Windows) - //Should be updated in Keychain + // Should be updated in Keychain guard let keychainUser: CurrentUserContainer = try? KeychainStore.shared.get(valueFor: ParseStorage.Keys.currentUser), let keychainUpdatedCurrentDate = keychainUser.currentUser?.updatedAt else { @@ -2535,7 +2536,7 @@ class ParseUserTests: XCTestCase { // swiftlint:disable:this type_body_length XCTAssertEqual(savedUpdatedAt, originalUpdatedAt) XCTAssertEqual(User.current?.customKey, user.customKey) - //Should be updated in memory + // Should be updated in memory guard let updatedCurrentDate = User.current?.updatedAt else { XCTFail("Should unwrap current date") expectation2.fulfill() @@ -2544,7 +2545,7 @@ class ParseUserTests: XCTestCase { // swiftlint:disable:this type_body_length XCTAssertEqual(updatedCurrentDate, originalUpdatedAt) #if !os(Linux) && !os(Android) && !os(Windows) - //Should be updated in Keychain + // Should be updated in Keychain guard let keychainUser: CurrentUserContainer = try? KeychainStore.shared.get(valueFor: ParseStorage.Keys.currentUser), let keychainUpdatedCurrentDate = keychainUser.currentUser?.updatedAt else { @@ -2612,6 +2613,7 @@ class ParseUserTests: XCTestCase { // swiftlint:disable:this type_body_length } } + // swiftlint:disable:next function_body_length func testDeleteAllAsyncMainQueueCurrent() { testLogin() MockURLProtocol.removeAll() @@ -2691,7 +2693,7 @@ class ParseUserTests: XCTestCase { // swiftlint:disable:this type_body_length } } - func testBecome() { // swiftlint:disable:this function_body_length + func testBecome() { testLogin() MockURLProtocol.removeAll() XCTAssertNotNil(User.current?.objectId) @@ -2711,7 +2713,7 @@ class ParseUserTests: XCTestCase { // swiftlint:disable:this type_body_length let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -2735,10 +2737,10 @@ class ParseUserTests: XCTestCase { // swiftlint:disable:this type_body_length XCTAssertGreaterThan(becomeUpdatedAt, originalUpdatedAt) XCTAssertNil(become.ACL) - //Should be updated in memory + // Should be updated in memory XCTAssertEqual(User.current?.updatedAt, becomeUpdatedAt) - //Should be updated in Keychain + // Should be updated in Keychain #if !os(Linux) && !os(Android) && !os(Windows) guard let keychainUser: CurrentUserContainer = try? KeychainStore.shared.get(valueFor: ParseStorage.Keys.currentUser) else { @@ -2775,7 +2777,7 @@ class ParseUserTests: XCTestCase { // swiftlint:disable:this type_body_length let encoded: Data! do { encoded = try serverResponse.getEncoder().encode(serverResponse, skipKeys: .none) - //Get dates in correct format from ParseDecoding strategy + // Get dates in correct format from ParseDecoding strategy userOnServer = try serverResponse.getDecoder().decode(User.self, from: encoded) } catch { XCTFail("Should encode/decode. Error \(error)") @@ -2804,11 +2806,11 @@ class ParseUserTests: XCTestCase { // swiftlint:disable:this type_body_length XCTAssertGreaterThan(becomeUpdatedAt, originalUpdatedAt) XCTAssertNil(become.ACL) - //Should be updated in memory + // Should be updated in memory XCTAssertEqual(User.current?.updatedAt, becomeUpdatedAt) #if !os(Linux) && !os(Android) && !os(Windows) - //Should be updated in Keychain + // Should be updated in Keychain guard let keychainUser: CurrentUserContainer = try? KeychainStore.shared.get(valueFor: ParseStorage.Keys.currentUser) else { XCTFail("Should get object from Keychain") diff --git a/Tests/ParseSwiftTests/ParseVersionTests.swift b/Tests/ParseSwiftTests/ParseVersionTests.swift index 5c5c23c5b..1afd3c093 100644 --- a/Tests/ParseSwiftTests/ParseVersionTests.swift +++ b/Tests/ParseSwiftTests/ParseVersionTests.swift @@ -125,7 +125,7 @@ class ParseVersionTests: XCTestCase { func testGreaterThanEqual() throws { let version1 = try ParseVersion("1.0.0") var version2 = version1 - //XCTAssertTrue(version1 >= version2) + // XCTAssertTrue(version1 >= version2) version2 = try ParseVersion("0.9.0") XCTAssertFalse(version2 >= version1) version2 = try ParseVersion("2.0.0")