From 7d7a312d0e9fbca008363418aa1762751c5bd1b3 Mon Sep 17 00:00:00 2001 From: Ian Saultz <52051793+atierian@users.noreply.github.com> Date: Wed, 21 Sep 2022 09:50:14 -0400 Subject: [PATCH] add swiftlint:disable comments to resolve errors --- Amplify/Categories/Auth/AuthCategory+ClientBehavior.swift | 2 +- Amplify/Core/Support/Amplify+Publisher.swift | 2 +- Amplify/Core/Support/AmplifyTask.swift | 2 +- .../Dependency/Pinpoint/Analytics/EventRecorder.swift | 4 ++-- .../Configuration/InitializeAuthConfiguration.swift | 4 ++-- .../CredentialStore/MigrateLegacyCredentialStore.swift | 2 +- .../VerifyDevicePasswordSRP+Calculations.swift | 2 +- .../SignIn/SRPAuth/VerifyPasswordSRP+Calculations.swift | 2 +- .../AWSCognitoAuthPlugin/SRP/AmplifySRPClient.swift | 8 ++++---- .../StateMachine/ErrorMapping/SignInError+Helper.swift | 2 +- .../Authentication/AuthenticationState+Resolver.swift | 2 +- .../Authorization/AuthorizationState+Resolver.swift | 2 +- .../RefreshSession/RefreshSessionState+Resolver.swift | 2 +- .../Resolvers/SignIn/SignInState+Resolver.swift | 2 +- .../Storage/CascadeDeleteOperation.swift | 2 +- ...AWSMutationDatabaseAdapter+MutationEventIngester.swift | 4 ++-- .../MutationEvent/MutationEventIngester.swift | 2 +- .../AWSDataStorePlugin/Sync/RemoteSyncEngine.swift | 2 +- .../Sync/RemoteSyncEngineBehavior.swift | 2 +- .../Service/Storage/AWSS3StorageService.swift | 2 +- 20 files changed, 26 insertions(+), 26 deletions(-) diff --git a/Amplify/Categories/Auth/AuthCategory+ClientBehavior.swift b/Amplify/Categories/Auth/AuthCategory+ClientBehavior.swift index df15e7041b..bbb64d024b 100644 --- a/Amplify/Categories/Auth/AuthCategory+ClientBehavior.swift +++ b/Amplify/Categories/Auth/AuthCategory+ClientBehavior.swift @@ -63,7 +63,7 @@ extension AuthCategory: AuthCategoryBehavior { } public func resetPassword(for username: String, options: AuthResetPasswordRequest.Options? = nil) async throws -> AuthResetPasswordResult { - return try await plugin.resetPassword(for: username,options: options) + return try await plugin.resetPassword(for: username,options: options) // swiftlint:disable:this comma } public func confirmResetPassword( diff --git a/Amplify/Core/Support/Amplify+Publisher.swift b/Amplify/Core/Support/Amplify+Publisher.swift index de6ef21ed0..24da499d89 100644 --- a/Amplify/Core/Support/Amplify+Publisher.swift +++ b/Amplify/Core/Support/Amplify+Publisher.swift @@ -47,7 +47,7 @@ public extension Amplify { } } } - .handleEvents(receiveCancel: { task.cancel() } ) + .handleEvents(receiveCancel: { task.cancel() } ) // swiftlint:disable:this closing_brace .eraseToAnyPublisher() } diff --git a/Amplify/Core/Support/AmplifyTask.swift b/Amplify/Core/Support/AmplifyTask.swift index c18b9635b2..ca5da3d2de 100644 --- a/Amplify/Core/Support/AmplifyTask.swift +++ b/Amplify/Core/Support/AmplifyTask.swift @@ -37,7 +37,7 @@ public protocol AmplifyInProcessReportingTask { } public extension AmplifyInProcessReportingTask where InProcess == Progress { - var progress : AmplifyAsyncSequence { + var progress : AmplifyAsyncSequence { // swiftlint:disable:this colon get async { await inProcess } diff --git a/AmplifyPlugins/Analytics/Sources/AWSPinpointAnalyticsPlugin/Dependency/Pinpoint/Analytics/EventRecorder.swift b/AmplifyPlugins/Analytics/Sources/AWSPinpointAnalyticsPlugin/Dependency/Pinpoint/Analytics/EventRecorder.swift index e92fbefb34..124d81ffb1 100644 --- a/AmplifyPlugins/Analytics/Sources/AWSPinpointAnalyticsPlugin/Dependency/Pinpoint/Analytics/EventRecorder.swift +++ b/AmplifyPlugins/Analytics/Sources/AWSPinpointAnalyticsPlugin/Dependency/Pinpoint/Analytics/EventRecorder.swift @@ -81,7 +81,7 @@ class EventRecorder: AnalyticsEventRecording { func submitAllEvents() async throws -> [PinpointEvent] { submittedEvents = [] let eventsBatch = try getBatchRecords() - if eventsBatch.count > 0 { + if eventsBatch.count > 0 { // swiftlint:disable:this empty_count let endpointProfile = await endpointClient.currentEndpointProfile() try await processBatch(eventsBatch, endpointProfile: endpointProfile) } @@ -96,7 +96,7 @@ class EventRecorder: AnalyticsEventRecording { try await submit(pinpointEvents: eventBatch, endpointProfile: endpointProfile) try storage.removeFailedEvents() let nextEventsBatch = try getBatchRecords() - if nextEventsBatch.count > 0 { + if nextEventsBatch.count > 0 { // swiftlint:disable:this empty_count try await processBatch(nextEventsBatch, endpointProfile: endpointProfile) } } diff --git a/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Actions/Configuration/InitializeAuthConfiguration.swift b/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Actions/Configuration/InitializeAuthConfiguration.swift index 0cbb2acf54..c64c2e8d99 100644 --- a/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Actions/Configuration/InitializeAuthConfiguration.swift +++ b/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Actions/Configuration/InitializeAuthConfiguration.swift @@ -30,10 +30,10 @@ struct InitializeAuthConfiguration: Action { if case .amplifyCredentials(let fetchedCredentials) = data { credentials = fetchedCredentials } - } + } // swiftlint:disable:this statement_position catch KeychainStoreError.itemNotFound { logVerbose("No existing session found.", environment: environment) - } + } // swiftlint:disable:this statement_position catch { logError("Error when loading amplify credentials: \(error)", environment: environment) } diff --git a/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Actions/CredentialStore/MigrateLegacyCredentialStore.swift b/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Actions/CredentialStore/MigrateLegacyCredentialStore.swift index 40ff051ad8..55b85a4276 100644 --- a/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Actions/CredentialStore/MigrateLegacyCredentialStore.swift +++ b/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Actions/CredentialStore/MigrateLegacyCredentialStore.swift @@ -15,7 +15,7 @@ struct MigrateLegacyCredentialStore: Action { /// Legacy Keys private let AWSCredentialsProviderClassKey = "AWSCognitoCredentialsProvider" - private let UserPoolClassKey = "AWSCognitoIdentityUserPool" + private let UserPoolClassKey = "AWSCognitoIdentityUserPool" // swiftlint:disable:this identifier_name private let AWSCredentialsProviderKeychainAccessKeyId = "accessKey" private let AWSCredentialsProviderKeychainSecretAccessKey = "secretKey" private let AWSCredentialsProviderKeychainSessionToken = "sessionKey" diff --git a/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Actions/SignIn/DeviceSRPAuth/VerifyDevicePasswordSRP+Calculations.swift b/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Actions/SignIn/DeviceSRPAuth/VerifyDevicePasswordSRP+Calculations.swift index 1a5e1f7b9d..24fe62ca2f 100644 --- a/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Actions/SignIn/DeviceSRPAuth/VerifyDevicePasswordSRP+Calculations.swift +++ b/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Actions/SignIn/DeviceSRPAuth/VerifyDevicePasswordSRP+Calculations.swift @@ -28,7 +28,7 @@ extension VerifyDevicePasswordSRP { do { let dateStr = stateData.clientTimestamp.utcString let clientClass = type(of: srpClient) - let u = try clientClass.calculateUHexValue( + let u = try clientClass.calculateUHexValue( // swiftlint:disable:this identifier_name clientPublicKeyHexValue: stateData.srpKeyPair.publicKeyHexValue, serverPublicKeyHexValue: serverPublicBHexString) // HKDF diff --git a/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Actions/SignIn/SRPAuth/VerifyPasswordSRP+Calculations.swift b/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Actions/SignIn/SRPAuth/VerifyPasswordSRP+Calculations.swift index 0f4e83bfed..243e01b25d 100644 --- a/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Actions/SignIn/SRPAuth/VerifyPasswordSRP+Calculations.swift +++ b/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Actions/SignIn/SRPAuth/VerifyPasswordSRP+Calculations.swift @@ -28,7 +28,7 @@ extension VerifyPasswordSRP { let strippedPoolId = strippedPoolId(poolId) let dateStr = stateData.clientTimestamp.utcString let clientClass = type(of: srpClient) - let u = try clientClass.calculateUHexValue( + let u = try clientClass.calculateUHexValue( // swiftlint:disable:this identifier_name clientPublicKeyHexValue: stateData.srpKeyPair.publicKeyHexValue, serverPublicKeyHexValue: serverPublicBHexString) // HKDF diff --git a/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/SRP/AmplifySRPClient.swift b/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/SRP/AmplifySRPClient.swift index bd76c0e862..e94c611adc 100644 --- a/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/SRP/AmplifySRPClient.swift +++ b/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/SRP/AmplifySRPClient.swift @@ -15,8 +15,8 @@ struct AmplifySRPClient: SRPClientBehavior { let client: SRPClientState init(NHexValue: String, gHexValue: String) throws { - guard let N = BigInt(NHexValue, radix: 16), - let g = BigInt(gHexValue, radix: 16) + guard let N = BigInt(NHexValue, radix: 16), // swiftlint:disable:this identifier_name + let g = BigInt(gHexValue, radix: 16) // swiftlint:disable:this identifier_name else { throw SRPError.numberConversion } @@ -36,7 +36,7 @@ struct AmplifySRPClient: SRPClientBehavior { return srpKeys } - func calculateSharedSecret(username: String, + func calculateSharedSecret(username: String, password: String, saltHexValue: String, clientPrivateKeyHexValue: String, @@ -78,7 +78,7 @@ struct AmplifySRPClient: SRPClientBehavior { let signedClientPublicKey = AmplifyBigIntHelper.getSignedData(num: clientPublicNum) let signedServerPublicKey = AmplifyBigIntHelper.getSignedData(num: serverPublicNum) - let u = SRPClientState.calculcateU(publicClientKey: signedClientPublicKey, + let u = SRPClientState.calculcateU(publicClientKey: signedClientPublicKey, // swiftlint:disable:this identifier_name publicServerKey: signedServerPublicKey) return u.asString(radix: 16) diff --git a/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/StateMachine/ErrorMapping/SignInError+Helper.swift b/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/StateMachine/ErrorMapping/SignInError+Helper.swift index 00f4e99d15..a30d682d2a 100644 --- a/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/StateMachine/ErrorMapping/SignInError+Helper.swift +++ b/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/StateMachine/ErrorMapping/SignInError+Helper.swift @@ -57,7 +57,7 @@ extension SignInError { case .service(let serviceError, _) = cognitoError, case .passwordResetRequiredException = serviceError { return true - } else if let cognitoError = serviceError as? SdkError, + } else if let cognitoError = serviceError as? SdkError, // swiftlint:disable:this statement_position case .client(let clientError, _) = cognitoError, case .retryError(let retryError) = clientError, let cognitoServiceError = retryError as? SdkError, diff --git a/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/StateMachine/Resolvers/Authentication/AuthenticationState+Resolver.swift b/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/StateMachine/Resolvers/Authentication/AuthenticationState+Resolver.swift index e0e3e7a6ce..a9cef59f6e 100644 --- a/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/StateMachine/Resolvers/Authentication/AuthenticationState+Resolver.swift +++ b/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/StateMachine/Resolvers/Authentication/AuthenticationState+Resolver.swift @@ -13,7 +13,7 @@ extension AuthenticationState { init() { } - func resolve( + func resolve( // swiftlint:disable:this cyclomatic_complexity oldState: StateType, byApplying event: StateMachineEvent ) -> StateResolution { diff --git a/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/StateMachine/Resolvers/Authorization/AuthorizationState+Resolver.swift b/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/StateMachine/Resolvers/Authorization/AuthorizationState+Resolver.swift index 2179a7c75d..3352046d51 100644 --- a/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/StateMachine/Resolvers/Authorization/AuthorizationState+Resolver.swift +++ b/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/StateMachine/Resolvers/Authorization/AuthorizationState+Resolver.swift @@ -15,7 +15,7 @@ extension AuthorizationState { init() { } - func resolve( + func resolve( // swiftlint:disable:this function_body_length cyclomatic_complexity oldState: StateType, byApplying event: StateMachineEvent ) -> StateResolution { diff --git a/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/StateMachine/Resolvers/RefreshSession/RefreshSessionState+Resolver.swift b/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/StateMachine/Resolvers/RefreshSession/RefreshSessionState+Resolver.swift index 30bce71f70..01db6196a0 100644 --- a/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/StateMachine/Resolvers/RefreshSession/RefreshSessionState+Resolver.swift +++ b/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/StateMachine/Resolvers/RefreshSession/RefreshSessionState+Resolver.swift @@ -14,7 +14,7 @@ extension RefreshSessionState { var defaultState: RefreshSessionState = .notStarted - func resolve(oldState: RefreshSessionState, + func resolve(oldState: RefreshSessionState, // swiftlint:disable:this cyclomatic_complexity byApplying event: StateMachineEvent) -> StateResolution { switch oldState { diff --git a/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/StateMachine/Resolvers/SignIn/SignInState+Resolver.swift b/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/StateMachine/Resolvers/SignIn/SignInState+Resolver.swift index 0bf1cb4eef..6bdb6ded6e 100644 --- a/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/StateMachine/Resolvers/SignIn/SignInState+Resolver.swift +++ b/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/StateMachine/Resolvers/SignIn/SignInState+Resolver.swift @@ -13,7 +13,7 @@ extension SignInState { typealias StateType = SignInState let defaultState = SignInState.notStarted - func resolve( + func resolve( // swiftlint:disable:this cyclomatic_complexity oldState: SignInState, byApplying event: StateMachineEvent) -> StateResolution { diff --git a/AmplifyPlugins/DataStore/Sources/AWSDataStorePlugin/Storage/CascadeDeleteOperation.swift b/AmplifyPlugins/DataStore/Sources/AWSDataStorePlugin/Storage/CascadeDeleteOperation.swift index 3edd5067fb..1446399ec5 100644 --- a/AmplifyPlugins/DataStore/Sources/AWSDataStorePlugin/Storage/CascadeDeleteOperation.swift +++ b/AmplifyPlugins/DataStore/Sources/AWSDataStorePlugin/Storage/CascadeDeleteOperation.swift @@ -178,7 +178,7 @@ public class CascadeDeleteOperation: AsynchronousOperation { let associatedModelIds = queriedModels.map { $0.1.identifier(schema: modelSchema).stringValue } associatedModels.append(contentsOf: queriedModels) - associatedModels.append(contentsOf: await recurseQueryAssociatedModels(modelSchema: associatedModelSchema, ids: associatedModelIds)) + associatedModels.append(contentsOf: await recurseQueryAssociatedModels(modelSchema: associatedModelSchema, ids: associatedModelIds)) // swiftlint:disable:this comma } return associatedModels } diff --git a/AmplifyPlugins/DataStore/Sources/AWSDataStorePlugin/Sync/MutationSync/AWSMutationDatabaseAdapter/AWSMutationDatabaseAdapter+MutationEventIngester.swift b/AmplifyPlugins/DataStore/Sources/AWSDataStorePlugin/Sync/MutationSync/AWSMutationDatabaseAdapter/AWSMutationDatabaseAdapter+MutationEventIngester.swift index 9e88d5c101..8d5ed45b8d 100644 --- a/AmplifyPlugins/DataStore/Sources/AWSDataStorePlugin/Sync/MutationSync/AWSMutationDatabaseAdapter/AWSMutationDatabaseAdapter+MutationEventIngester.swift +++ b/AmplifyPlugins/DataStore/Sources/AWSDataStorePlugin/Sync/MutationSync/AWSMutationDatabaseAdapter/AWSMutationDatabaseAdapter+MutationEventIngester.swift @@ -13,7 +13,7 @@ extension AWSMutationDatabaseAdapter: MutationEventIngester { /// Accepts a mutation event without a version, applies the latest version from the MutationSyncMetadata table, /// writes the updated mutation event to the local database, then submits it to `mutationEventSubject` - func submit(mutationEvent: MutationEvent, completion: @escaping (Result)->Void) { + func submit(mutationEvent: MutationEvent, completion: @escaping (Result)->Void) { // swiftlint:disable:this return_arrow_whitespace Task { log.verbose("\(#function): \(mutationEvent)") @@ -32,7 +32,7 @@ extension AWSMutationDatabaseAdapter: MutationEventIngester { /// rejects the event with an error func resolveConflictsThenSave(mutationEvent: MutationEvent, storageAdapter: StorageEngineAdapter, - completion: @escaping (Result)->Void) { + completion: @escaping (Result)->Void) { // swiftlint:disable:this return_arrow_whitespace // We don't want to query MutationSync because a) we already have the model, and b) delete mutations // are submitted *after* the delete has already been applied to the local data store, meaning there is no model diff --git a/AmplifyPlugins/DataStore/Sources/AWSDataStorePlugin/Sync/MutationSync/MutationEvent/MutationEventIngester.swift b/AmplifyPlugins/DataStore/Sources/AWSDataStorePlugin/Sync/MutationSync/MutationEvent/MutationEventIngester.swift index 6a116d76e4..bbe1a65a6f 100644 --- a/AmplifyPlugins/DataStore/Sources/AWSDataStorePlugin/Sync/MutationSync/MutationEvent/MutationEventIngester.swift +++ b/AmplifyPlugins/DataStore/Sources/AWSDataStorePlugin/Sync/MutationSync/MutationEvent/MutationEventIngester.swift @@ -10,5 +10,5 @@ import Combine /// Ingests MutationEvents from and writes them to the MutationEvent persistent store protocol MutationEventIngester: AnyObject { - func submit(mutationEvent: MutationEvent, completion: @escaping (Result)->Void) + func submit(mutationEvent: MutationEvent, completion: @escaping (Result)->Void) // swiftlint:disable:this return_arrow_whitespace } diff --git a/AmplifyPlugins/DataStore/Sources/AWSDataStorePlugin/Sync/RemoteSyncEngine.swift b/AmplifyPlugins/DataStore/Sources/AWSDataStorePlugin/Sync/RemoteSyncEngine.swift index 7ebead0060..8a32c406c3 100644 --- a/AmplifyPlugins/DataStore/Sources/AWSDataStorePlugin/Sync/RemoteSyncEngine.swift +++ b/AmplifyPlugins/DataStore/Sources/AWSDataStorePlugin/Sync/RemoteSyncEngine.swift @@ -238,7 +238,7 @@ class RemoteSyncEngine: RemoteSyncEngineBehavior { } } - func submit(_ mutationEvent: MutationEvent, completion: @escaping (Result)->Void) { + func submit(_ mutationEvent: MutationEvent, completion: @escaping (Result)->Void) { // swiftlint:disable:this return_arrow_whitespace mutationEventIngester.submit(mutationEvent: mutationEvent, completion: completion) } diff --git a/AmplifyPlugins/DataStore/Sources/AWSDataStorePlugin/Sync/RemoteSyncEngineBehavior.swift b/AmplifyPlugins/DataStore/Sources/AWSDataStorePlugin/Sync/RemoteSyncEngineBehavior.swift index 5ad4e4e3f0..48510eb222 100644 --- a/AmplifyPlugins/DataStore/Sources/AWSDataStorePlugin/Sync/RemoteSyncEngineBehavior.swift +++ b/AmplifyPlugins/DataStore/Sources/AWSDataStorePlugin/Sync/RemoteSyncEngineBehavior.swift @@ -47,7 +47,7 @@ protocol RemoteSyncEngineBehavior: AnyObject { /// Submits a new mutation for synchronization to the remote API. The response will be handled by the appropriate /// reconciliation queue - func submit(_ mutationEvent: MutationEvent, completion: @escaping (Result)->Void) + func submit(_ mutationEvent: MutationEvent, completion: @escaping (Result)->Void) // swiftlint:disable:this return_arrow_whitespace var publisher: AnyPublisher { get } } diff --git a/AmplifyPlugins/Storage/Sources/AWSS3StoragePlugin/Service/Storage/AWSS3StorageService.swift b/AmplifyPlugins/Storage/Sources/AWSS3StoragePlugin/Service/Storage/AWSS3StorageService.swift index eae556550d..37f98d5c9e 100644 --- a/AmplifyPlugins/Storage/Sources/AWSS3StoragePlugin/Service/Storage/AWSS3StorageService.swift +++ b/AmplifyPlugins/Storage/Sources/AWSS3StoragePlugin/Service/Storage/AWSS3StorageService.swift @@ -56,7 +56,7 @@ class AWSS3StorageService: AWSS3StorageServiceBehaviour, StorageServiceProxy { let awsS3 = AWSS3Adapter(s3Client, config: clientConfig) let preSignedURLBuilder = AWSS3PreSignedURLBuilderAdapter(config: clientConfig, bucket: bucket) - var _sessionConfiguration: URLSessionConfiguration + var _sessionConfiguration: URLSessionConfiguration // swiftlint:disable:this identifier_name if let sessionConfiguration = sessionConfiguration { _sessionConfiguration = sessionConfiguration } else {