Enable SwiftLint rule 'unneeded_parentheses_in_closure_argument' and fix all violations
This commit is contained in:
parent
5cca2c30d8
commit
ab80e5297e
8 changed files with 13 additions and 13 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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)))
|
||||
|
|
|
|||
|
|
@ -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]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue