diff --git a/.swiftlint.yml b/.swiftlint.yml index af9839e..24a9f6e 100644 --- a/.swiftlint.yml +++ b/.swiftlint.yml @@ -173,7 +173,7 @@ whitelist_rules: - type_name - unavailable_function - unneeded_break_in_switch -# - unneeded_parentheses_in_closure_argument + - unneeded_parentheses_in_closure_argument # - unowned_variable_capture - untyped_error_in_catch - unused_capture_list diff --git a/pass/Controllers/AdvancedSettingsTableViewController.swift b/pass/Controllers/AdvancedSettingsTableViewController.swift index 1da2090..5352160 100644 --- a/pass/Controllers/AdvancedSettingsTableViewController.swift +++ b/pass/Controllers/AdvancedSettingsTableViewController.swift @@ -49,7 +49,7 @@ class AdvancedSettingsTableViewController: UITableViewController { if tableView.cellForRow(at: indexPath) == eraseDataTableViewCell { let alert = UIAlertController(title: "ErasePasswordStoreData?".localize(), message: "EraseExplanation.".localize(), preferredStyle: UIAlertController.Style.alert) alert.addAction( - UIAlertAction(title: "ErasePasswordStoreData".localize(), style: UIAlertAction.Style.destructive) { [unowned self] (_) -> Void in + UIAlertAction(title: "ErasePasswordStoreData".localize(), style: UIAlertAction.Style.destructive) { [unowned self] _ -> Void in SVProgressHUD.show(withStatus: "Erasing...".localize()) self.passwordStore.erase() self.navigationController!.popViewController(animated: true) @@ -62,7 +62,7 @@ class AdvancedSettingsTableViewController: UITableViewController { } else if tableView.cellForRow(at: indexPath) == discardChangesTableViewCell { let alert = UIAlertController(title: "DiscardAllLocalChanges?".localize(), message: "DiscardExplanation.".localize(), preferredStyle: UIAlertController.Style.alert) alert.addAction( - UIAlertAction(title: "DiscardAllLocalChanges".localize(), style: UIAlertAction.Style.destructive) { [unowned self] (_) -> Void in + UIAlertAction(title: "DiscardAllLocalChanges".localize(), style: UIAlertAction.Style.destructive) { [unowned self] _ -> Void in SVProgressHUD.show(withStatus: "Resetting...".localize()) do { let numberDiscarded = try self.passwordStore.reset() diff --git a/pass/Controllers/PasswordEditorTableViewController.swift b/pass/Controllers/PasswordEditorTableViewController.swift index dc056dc..f08a0c5 100644 --- a/pass/Controllers/PasswordEditorTableViewController.swift +++ b/pass/Controllers/PasswordEditorTableViewController.swift @@ -247,7 +247,7 @@ class PasswordEditorTableViewController: UITableViewController { if selectedCell == deletePasswordCell { let alert = UIAlertController(title: "DeletePassword?".localize(), message: nil, preferredStyle: UIAlertController.Style.alert) alert.addAction( - UIAlertAction(title: "Delete".localize(), style: UIAlertAction.Style.destructive) { [unowned self] (_) -> Void in + UIAlertAction(title: "Delete".localize(), style: UIAlertAction.Style.destructive) { [unowned self] _ -> Void in self.performSegue(withIdentifier: "deletePasswordSegue", sender: self) } ) @@ -441,7 +441,7 @@ extension PasswordEditorTableViewController: SFSafariViewControllerDelegate { message.append(Utils.attributedPassword(plainPassword: generatedPassword)) alert.setValue(message, forKey: "attributedMessage") alert.addAction( - UIAlertAction(title: "Yes", style: UIAlertAction.Style.default) { [unowned self] (_) -> Void in + UIAlertAction(title: "Yes", style: UIAlertAction.Style.default) { [unowned self] _ -> Void in // update tableData so to make sure reloadData() works correctly self.tableData[self.passwordSection][0][PasswordEditorCellKey.content] = generatedPassword // update cell manually, no need to call reloadData() diff --git a/passExtension/Controllers/ExtensionViewController.swift b/passExtension/Controllers/ExtensionViewController.swift index d33aab5..2114030 100644 --- a/passExtension/Controllers/ExtensionViewController.swift +++ b/passExtension/Controllers/ExtensionViewController.swift @@ -67,7 +67,7 @@ class ExtensionViewController: UIViewController, UITableViewDataSource, UITableV for provider in itemProviders { // search using the extensionContext inputs if provider.hasItemConformingToTypeIdentifier(OnePasswordExtensionActions.findLogin) { - provider.loadItem(forTypeIdentifier: OnePasswordExtensionActions.findLogin, options: nil) { (item, _) -> Void in + provider.loadItem(forTypeIdentifier: OnePasswordExtensionActions.findLogin, options: nil) { item, _ -> Void in let dictionary = item as! NSDictionary var url: String? if var urlString = dictionary[OnePasswordExtensionKey.URLStringKey] as? String { @@ -85,7 +85,7 @@ class ExtensionViewController: UIViewController, UITableViewDataSource, UITableV } } } else if provider.hasItemConformingToTypeIdentifier(kUTTypePropertyList as String) { - provider.loadItem(forTypeIdentifier: kUTTypePropertyList as String, options: nil) { (item, _) -> Void in + provider.loadItem(forTypeIdentifier: kUTTypePropertyList as String, options: nil) { item, _ -> Void in var url: String? if let dictionary = item as? NSDictionary, let results = dictionary[NSExtensionJavaScriptPreprocessingResultsKey] as? NSDictionary, @@ -104,7 +104,7 @@ class ExtensionViewController: UIViewController, UITableViewDataSource, UITableV } } } else if provider.hasItemConformingToTypeIdentifier(kUTTypeURL as String) { - provider.loadItem(forTypeIdentifier: kUTTypeURL as String, options: nil) { (item, _) -> Void in + provider.loadItem(forTypeIdentifier: kUTTypeURL as String, options: nil) { item, _ -> Void in let url = (item as? NSURL)!.host DispatchQueue.main.async { [weak self] in self?.extensionAction = .fillBrowser diff --git a/passKit/Controllers/PasscodeLockViewController.swift b/passKit/Controllers/PasscodeLockViewController.swift index 4b5b0fc..133831c 100644 --- a/passKit/Controllers/PasscodeLockViewController.swift +++ b/passKit/Controllers/PasscodeLockViewController.swift @@ -193,7 +193,7 @@ open class PasscodeLockViewController: UIViewController, UITextFieldDelegate { func forgotPasscodeButtonPressedAction(_: UIButton) { let alert = UIAlertController(title: "ResetPass".localize(), message: "ResetPassExplanation.".localize(), preferredStyle: UIAlertController.Style.alert) alert.addAction( - UIAlertAction(title: "ErasePasswordStoreData".localize(), style: UIAlertAction.Style.destructive) { [unowned self] (_) -> Void in + UIAlertAction(title: "ErasePasswordStoreData".localize(), style: UIAlertAction.Style.destructive) { [unowned self] _ -> Void in let myContext = LAContext() var error: NSError? // If the device passcode is not set, reset the app. diff --git a/passKit/Models/GitCredential.swift b/passKit/Models/GitCredential.swift index 53aa5d3..c062afe 100644 --- a/passKit/Models/GitCredential.swift +++ b/passKit/Models/GitCredential.swift @@ -24,7 +24,7 @@ public struct GitCredential { public func credentialProvider(requestCredentialPassword: @escaping (Credential, String?) -> String?) throws -> GTCredentialProvider { var attempts = 0 - return GTCredentialProvider { (_, _, _) -> (GTCredential?) in + return GTCredentialProvider { _, _, _ -> (GTCredential?) in var credential: GTCredential? switch self.credential { diff --git a/passKit/Models/PasswordStore.swift b/passKit/Models/PasswordStore.swift index fd128b7..a866600 100644 --- a/passKit/Models/PasswordStore.swift +++ b/passKit/Models/PasswordStore.swift @@ -270,7 +270,7 @@ public class PasswordStore { do { var q = try fm.contentsOfDirectory(atPath: storeURL.path) .filter { !$0.hasPrefix(".") } - .map { (filename) -> PasswordEntity in + .map { filename -> PasswordEntity in let passwordEntity = NSEntityDescription.insertNewObject(forEntityName: "PasswordEntity", into: context) as! PasswordEntity if filename.hasSuffix(".gpg") { passwordEntity.name = String(filename.prefix(upTo: filename.index(filename.endIndex, offsetBy: -4))) @@ -294,7 +294,7 @@ public class PasswordStore { e.isDir = true let files = try fm.contentsOfDirectory(atPath: filePath) .filter { !$0.hasPrefix(".") } - .map { (filename) -> PasswordEntity in + .map { filename -> PasswordEntity in let passwordEntity = NSEntityDescription.insertNewObject(forEntityName: "PasswordEntity", into: context) as! PasswordEntity if filename.hasSuffix(".gpg") { passwordEntity.name = String(filename.prefix(upTo: filename.index(filename.endIndex, offsetBy: -4))) diff --git a/passKitTests/Models/PasswordStoreTest.swift b/passKitTests/Models/PasswordStoreTest.swift index c9a7554..0bd45b3 100644 --- a/passKitTests/Models/PasswordStoreTest.swift +++ b/passKitTests/Models/PasswordStoreTest.swift @@ -13,7 +13,7 @@ import XCTest class PasswordStoreTest: XCTestCase { let cloneOptions: [String: GTCredentialProvider] = { - let credentialProvider = GTCredentialProvider { (_, _, _) -> (GTCredential?) in + let credentialProvider = GTCredentialProvider { _, _, _ -> (GTCredential?) in try? GTCredential(userName: "", password: "") } return [GTRepositoryCloneOptionsCredentialProvider: credentialProvider]