From 959e5968dd9c028fe311d99b742ca38c228340fe Mon Sep 17 00:00:00 2001 From: Abhash Kumar Singh Date: Fri, 22 Nov 2024 14:22:24 -0800 Subject: [PATCH] chore: fix swiftlint errors (#3921) --- .../Auth/AuthCategory+WebAuthnBehaviour.swift | 4 ++-- .../Actions/SignIn/VerifySignInChallenge.swift | 2 +- .../SignIn/WebAuthn/PlatformWebAuthnCredentials.swift | 2 +- .../AWSCognitoAuthCredentialStore.swift | 3 +-- .../StateMachine/CodeGen/Data/SignUpEventData.swift | 10 +++++----- .../Resolvers/SignIn/SignInState+Resolver.swift | 1 + .../Resolvers/SignUp/SignUpState+Resolver.swift | 4 ++-- .../AWSCognitoAuthPlugin/Task/AWSAuthSignUpTask.swift | 2 +- .../Task/Models/AWSWebAuthCredentialsModels.swift | 2 +- .../AuthAssociateWebAuthnCredentialTask.swift | 4 ++-- .../Protocols/AuthDeleteWebAuthnCredentialTask.swift | 4 ++-- .../Protocols/AuthListWebAuthnCredentialsTask.swift | 4 ++-- 12 files changed, 21 insertions(+), 21 deletions(-) diff --git a/Amplify/Categories/Auth/AuthCategory+WebAuthnBehaviour.swift b/Amplify/Categories/Auth/AuthCategory+WebAuthnBehaviour.swift index 96f5e78f7e..be1a552453 100644 --- a/Amplify/Categories/Auth/AuthCategory+WebAuthnBehaviour.swift +++ b/Amplify/Categories/Auth/AuthCategory+WebAuthnBehaviour.swift @@ -15,7 +15,7 @@ extension AuthCategory: AuthCategoryWebAuthnBehaviour { options: AuthAssociateWebAuthnCredentialRequest.Options? = nil ) async throws { try await plugin.associateWebAuthnCredential( - presentationAnchor:presentationAnchor, + presentationAnchor: presentationAnchor, options: options ) } @@ -25,7 +25,7 @@ extension AuthCategory: AuthCategoryWebAuthnBehaviour { options: AuthAssociateWebAuthnCredentialRequest.Options? = nil ) async throws { try await plugin.associateWebAuthnCredential( - presentationAnchor:presentationAnchor, + presentationAnchor: presentationAnchor, options: options ) } diff --git a/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Actions/SignIn/VerifySignInChallenge.swift b/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Actions/SignIn/VerifySignInChallenge.swift index c939b6449c..34dc973111 100644 --- a/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Actions/SignIn/VerifySignInChallenge.swift +++ b/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Actions/SignIn/VerifySignInChallenge.swift @@ -33,7 +33,7 @@ struct VerifySignInChallenge: Action { environment: environment, username: username) return - } else if case .continueSignInWithFirstFactorSelection(_) = currentSignInStep, + } else if case .continueSignInWithFirstFactorSelection = currentSignInStep, let authFactorType = AuthFactorType(rawValue: confirmSignEventData.answer) { if (authFactorType == .password || authFactorType == .passwordSRP) { try await handleContinueSignInWithPassword( diff --git a/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Actions/SignIn/WebAuthn/PlatformWebAuthnCredentials.swift b/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Actions/SignIn/WebAuthn/PlatformWebAuthnCredentials.swift index e6b66e0c04..12e176ca7b 100644 --- a/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Actions/SignIn/WebAuthn/PlatformWebAuthnCredentials.swift +++ b/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Actions/SignIn/WebAuthn/PlatformWebAuthnCredentials.swift @@ -43,7 +43,7 @@ class PlatformWebAuthnCredentials: NSObject, WebAuthnCredentialsProtocol { // - MARK: CredentialAsserterProtocol @available(iOS 17.4, macOS 13.5, visionOS 1.0, *) -extension PlatformWebAuthnCredentials: CredentialAsserterProtocol{ +extension PlatformWebAuthnCredentials: CredentialAsserterProtocol { func assert(with options: CredentialAssertionOptions) async throws -> CredentialAssertionPayload { guard assertionContinuation == nil else { throw WebAuthnError.unknown( diff --git a/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/CredentialStorage/AWSCognitoAuthCredentialStore.swift b/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/CredentialStorage/AWSCognitoAuthCredentialStore.swift index 28654896ea..1e8b1f77f5 100644 --- a/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/CredentialStorage/AWSCognitoAuthCredentialStore.swift +++ b/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/CredentialStorage/AWSCognitoAuthCredentialStore.swift @@ -63,8 +63,7 @@ struct AWSCognitoAuthCredentialStore { /// - Old Identity Pool Config == New Identity Pool Config if oldUserPoolConfiguration == nil && newIdentityConfigData != nil && - oldIdentityPoolConfiguration == newIdentityConfigData - { + oldIdentityPoolConfiguration == newIdentityConfigData { // retrieve data from the old namespace and save with the new namespace if let oldCognitoCredentialsData = try? keychain._getData(oldNameSpace) { try? keychain._set(oldCognitoCredentialsData, key: newNameSpace) diff --git a/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/StateMachine/CodeGen/Data/SignUpEventData.swift b/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/StateMachine/CodeGen/Data/SignUpEventData.swift index 67b6f75d97..c32b1c748c 100644 --- a/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/StateMachine/CodeGen/Data/SignUpEventData.swift +++ b/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/StateMachine/CodeGen/Data/SignUpEventData.swift @@ -14,8 +14,8 @@ struct SignUpEventData { var session: String? init(username: String, - clientMetadata: [String : String]? = nil, - validationData: [String : String]? = nil, + clientMetadata: [String: String]? = nil, + validationData: [String: String]? = nil, session: String? = nil) { self.username = username self.clientMetadata = clientMetadata @@ -31,9 +31,9 @@ extension SignUpEventData: CustomDebugDictionaryConvertible { var debugDictionary: [String: Any] { [ "username": username.masked(), - "clientMetadata" : clientMetadata ?? "", - "validationData" : validationData ?? "", - "session" : session?.masked() ?? "" + "clientMetadata": clientMetadata ?? "", + "validationData": validationData ?? "", + "session": session?.masked() ?? "" ] } } 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 b6c946aecb..bde1186eb6 100644 --- a/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/StateMachine/Resolvers/SignIn/SignInState+Resolver.swift +++ b/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/StateMachine/Resolvers/SignIn/SignInState+Resolver.swift @@ -6,6 +6,7 @@ // import Foundation +// swiftlint:disable type_body_length extension SignInState { // swiftlint:disable:next nesting diff --git a/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/StateMachine/Resolvers/SignUp/SignUpState+Resolver.swift b/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/StateMachine/Resolvers/SignUp/SignUpState+Resolver.swift index 34f10e117c..c7d8b937ba 100644 --- a/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/StateMachine/Resolvers/SignUp/SignUpState+Resolver.swift +++ b/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/StateMachine/Resolvers/SignUp/SignUpState+Resolver.swift @@ -22,11 +22,11 @@ extension SignUpState { switch oldState { case .notStarted: return resolveNotStarted(byApplying: signUpEvent, from: oldState) - case .initiatingSignUp(_): + case .initiatingSignUp: return resolveInitiatingSignUp(byApplying: signUpEvent, from: oldState) case .awaitingUserConfirmation: return resolveAwaitingUserConfirmation(byApplying: signUpEvent, from: oldState) - case .confirmingSignUp(_): + case .confirmingSignUp: return resolveConfirmingSignUp(byApplying: signUpEvent, from: oldState) case .signedUp: return resolveSignedUp(byApplying: signUpEvent, from: oldState) diff --git a/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Task/AWSAuthSignUpTask.swift b/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Task/AWSAuthSignUpTask.swift index 1f18a2bc0a..e58ec257ea 100644 --- a/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Task/AWSAuthSignUpTask.swift +++ b/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Task/AWSAuthSignUpTask.swift @@ -91,7 +91,7 @@ class AWSAuthSignUpTask: AuthSignUpTask, DefaultLogger { let stateSequences = await authStateMachine.listen() log.verbose("Validating current state") for await state in stateSequences { - guard case .configured(_ , _, let signUpState) = state else { + guard case .configured(_, _, let signUpState) = state else { continue } diff --git a/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Task/Models/AWSWebAuthCredentialsModels.swift b/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Task/Models/AWSWebAuthCredentialsModels.swift index 3a471f6e1d..00ea4348a7 100644 --- a/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Task/Models/AWSWebAuthCredentialsModels.swift +++ b/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Task/Models/AWSWebAuthCredentialsModels.swift @@ -16,7 +16,7 @@ enum WebAuthnCredentialError: Error { } struct CredentialAssertionOptions: Codable, Equatable { - private enum CodingKeys : String, CodingKey { + private enum CodingKeys: String, CodingKey { case challengeString = "challenge", relyingPartyId = "rpId" } private let challengeString: String diff --git a/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Task/Protocols/AuthAssociateWebAuthnCredentialTask.swift b/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Task/Protocols/AuthAssociateWebAuthnCredentialTask.swift index d24f559eed..48a7ea0cd5 100644 --- a/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Task/Protocols/AuthAssociateWebAuthnCredentialTask.swift +++ b/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Task/Protocols/AuthAssociateWebAuthnCredentialTask.swift @@ -12,8 +12,8 @@ import Foundation protocol AuthAssociateWebAuthnCredentialTask: AmplifyAuthTask where Request == AuthAssociateWebAuthnCredentialRequest, Success == Void, - Failure == AuthError -{} + Failure == AuthError { +} public extension HubPayload.EventName.Auth { static let associateWebAuthnCredentialAPI = "Auth.associateWebAuthnCredentialAPI" diff --git a/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Task/Protocols/AuthDeleteWebAuthnCredentialTask.swift b/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Task/Protocols/AuthDeleteWebAuthnCredentialTask.swift index b51350c6dd..d377b99cdb 100644 --- a/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Task/Protocols/AuthDeleteWebAuthnCredentialTask.swift +++ b/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Task/Protocols/AuthDeleteWebAuthnCredentialTask.swift @@ -11,8 +11,8 @@ import Foundation protocol AuthDeleteWebAuthnCredentialTask: AmplifyAuthTask where Request == AuthDeleteWebAuthnCredentialRequest, Success == Void, - Failure == AuthError -{} + Failure == AuthError { +} public extension HubPayload.EventName.Auth { static let deleteWebAuthnCredentialAPI = "Auth.deleteWebAuthnCredentialAPI" diff --git a/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Task/Protocols/AuthListWebAuthnCredentialsTask.swift b/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Task/Protocols/AuthListWebAuthnCredentialsTask.swift index 5a2e8c0ba6..16163ecaf9 100644 --- a/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Task/Protocols/AuthListWebAuthnCredentialsTask.swift +++ b/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Task/Protocols/AuthListWebAuthnCredentialsTask.swift @@ -11,8 +11,8 @@ import Foundation protocol AuthListWebAuthnCredentialsTask: AmplifyAuthTask where Request == AuthListWebAuthnCredentialsRequest, Success == AuthListWebAuthnCredentialsResult, - Failure == AuthError -{} + Failure == AuthError { +} public extension HubPayload.EventName.Auth { static let listWebAuthnCredentialsAPI = "Auth.listWebAuthnCredentialsAPI"