From 8828298afbdd75b73518d540e1bab6e1a27768d2 Mon Sep 17 00:00:00 2001 From: Danny Moesch Date: Sun, 5 Jul 2020 00:33:01 +0200 Subject: [PATCH] Enable SwiftLint rule 'multiline_parameters_brackets' and fix all violations --- .swiftlint.yml | 2 +- pass/Helpers/GitCredentialPassword.swift | 8 ++++-- passKit/Models/PasswordStore.swift | 36 ++++++++++++++---------- 3 files changed, 27 insertions(+), 19 deletions(-) diff --git a/.swiftlint.yml b/.swiftlint.yml index d881fa6..db40d85 100644 --- a/.swiftlint.yml +++ b/.swiftlint.yml @@ -101,7 +101,7 @@ whitelist_rules: - multiline_function_chains - multiline_literal_brackets - multiline_parameters -# - multiline_parameters_brackets + - multiline_parameters_brackets # - multiple_closures_with_trailing_closure # - nesting - nimble_operator diff --git a/pass/Helpers/GitCredentialPassword.swift b/pass/Helpers/GitCredentialPassword.swift index 96a05f1..0ab7533 100644 --- a/pass/Helpers/GitCredentialPassword.swift +++ b/pass/Helpers/GitCredentialPassword.swift @@ -10,9 +10,11 @@ import Foundation import passKit import SVProgressHUD -public func requestGitCredentialPassword(credential: GitCredential.Credential, - lastPassword: String?, - controller: UIViewController) -> String? { +public func requestGitCredentialPassword( + credential: GitCredential.Credential, + lastPassword: String?, + controller: UIViewController +) -> String? { let sem = DispatchSemaphore(value: 0) var password: String? let message: String = { diff --git a/passKit/Models/PasswordStore.swift b/passKit/Models/PasswordStore.swift index 6a82c54..fd128b7 100644 --- a/passKit/Models/PasswordStore.swift +++ b/passKit/Models/PasswordStore.swift @@ -171,12 +171,14 @@ public class PasswordStore { } } - public func cloneRepository(remoteRepoURL: URL, - credential: GitCredential, - branchName: String, - requestCredentialPassword: @escaping (GitCredential.Credential, String?) -> String?, - transferProgressBlock: @escaping (UnsafePointer, UnsafeMutablePointer) -> Void, - checkoutProgressBlock: @escaping (String, UInt, UInt) -> Void) throws { + public func cloneRepository( + remoteRepoURL: URL, + credential: GitCredential, + branchName: String, + requestCredentialPassword: @escaping (GitCredential.Credential, String?) -> String?, + transferProgressBlock: @escaping (UnsafePointer, UnsafeMutablePointer) -> Void, + checkoutProgressBlock: @escaping (String, UInt, UInt) -> Void + ) throws { do { let credentialProvider = try credential.credentialProvider(requestCredentialPassword: requestCredentialPassword) let options = [GTRepositoryCloneOptionsCredentialProvider: credentialProvider] @@ -187,12 +189,14 @@ public class PasswordStore { } } - public func cloneRepository(remoteRepoURL: URL, - options: [AnyHashable: Any]? = nil, - branchName: String, - transferProgressBlock: @escaping (UnsafePointer, UnsafeMutablePointer) -> Void, - checkoutProgressBlock: @escaping (String, UInt, UInt) -> Void, - completion: @escaping () -> Void = {}) throws { + public func cloneRepository( + remoteRepoURL: URL, + options: [AnyHashable: Any]? = nil, + branchName: String, + transferProgressBlock: @escaping (UnsafePointer, UnsafeMutablePointer) -> Void, + checkoutProgressBlock: @escaping (String, UInt, UInt) -> Void, + completion: @escaping () -> Void = {} + ) throws { try? fm.removeItem(at: storeURL) try? fm.removeItem(at: tempStoreURL) gitPassword = nil @@ -241,9 +245,11 @@ public class PasswordStore { try storeRepository.moveHEAD(to: localBranch.reference) } - public func pullRepository(credential: GitCredential, - requestCredentialPassword: @escaping (GitCredential.Credential, String?) -> String?, - progressBlock: @escaping (UnsafePointer, UnsafeMutablePointer) -> Void) throws { + public func pullRepository( + credential: GitCredential, + requestCredentialPassword: @escaping (GitCredential.Credential, String?) -> String?, + progressBlock: @escaping (UnsafePointer, UnsafeMutablePointer) -> Void + ) throws { guard let storeRepository = storeRepository else { throw AppError.RepositoryNotSet }