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
|
- type_name
|
||||||
- unavailable_function
|
- unavailable_function
|
||||||
- unneeded_break_in_switch
|
- unneeded_break_in_switch
|
||||||
# - unneeded_parentheses_in_closure_argument
|
- unneeded_parentheses_in_closure_argument
|
||||||
# - unowned_variable_capture
|
# - unowned_variable_capture
|
||||||
- untyped_error_in_catch
|
- untyped_error_in_catch
|
||||||
- unused_capture_list
|
- unused_capture_list
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,7 @@ class AdvancedSettingsTableViewController: UITableViewController {
|
||||||
if tableView.cellForRow(at: indexPath) == eraseDataTableViewCell {
|
if tableView.cellForRow(at: indexPath) == eraseDataTableViewCell {
|
||||||
let alert = UIAlertController(title: "ErasePasswordStoreData?".localize(), message: "EraseExplanation.".localize(), preferredStyle: UIAlertController.Style.alert)
|
let alert = UIAlertController(title: "ErasePasswordStoreData?".localize(), message: "EraseExplanation.".localize(), preferredStyle: UIAlertController.Style.alert)
|
||||||
alert.addAction(
|
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())
|
SVProgressHUD.show(withStatus: "Erasing...".localize())
|
||||||
self.passwordStore.erase()
|
self.passwordStore.erase()
|
||||||
self.navigationController!.popViewController(animated: true)
|
self.navigationController!.popViewController(animated: true)
|
||||||
|
|
@ -62,7 +62,7 @@ class AdvancedSettingsTableViewController: UITableViewController {
|
||||||
} else if tableView.cellForRow(at: indexPath) == discardChangesTableViewCell {
|
} else if tableView.cellForRow(at: indexPath) == discardChangesTableViewCell {
|
||||||
let alert = UIAlertController(title: "DiscardAllLocalChanges?".localize(), message: "DiscardExplanation.".localize(), preferredStyle: UIAlertController.Style.alert)
|
let alert = UIAlertController(title: "DiscardAllLocalChanges?".localize(), message: "DiscardExplanation.".localize(), preferredStyle: UIAlertController.Style.alert)
|
||||||
alert.addAction(
|
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())
|
SVProgressHUD.show(withStatus: "Resetting...".localize())
|
||||||
do {
|
do {
|
||||||
let numberDiscarded = try self.passwordStore.reset()
|
let numberDiscarded = try self.passwordStore.reset()
|
||||||
|
|
|
||||||
|
|
@ -247,7 +247,7 @@ class PasswordEditorTableViewController: UITableViewController {
|
||||||
if selectedCell == deletePasswordCell {
|
if selectedCell == deletePasswordCell {
|
||||||
let alert = UIAlertController(title: "DeletePassword?".localize(), message: nil, preferredStyle: UIAlertController.Style.alert)
|
let alert = UIAlertController(title: "DeletePassword?".localize(), message: nil, preferredStyle: UIAlertController.Style.alert)
|
||||||
alert.addAction(
|
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)
|
self.performSegue(withIdentifier: "deletePasswordSegue", sender: self)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
@ -441,7 +441,7 @@ extension PasswordEditorTableViewController: SFSafariViewControllerDelegate {
|
||||||
message.append(Utils.attributedPassword(plainPassword: generatedPassword))
|
message.append(Utils.attributedPassword(plainPassword: generatedPassword))
|
||||||
alert.setValue(message, forKey: "attributedMessage")
|
alert.setValue(message, forKey: "attributedMessage")
|
||||||
alert.addAction(
|
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
|
// update tableData so to make sure reloadData() works correctly
|
||||||
self.tableData[self.passwordSection][0][PasswordEditorCellKey.content] = generatedPassword
|
self.tableData[self.passwordSection][0][PasswordEditorCellKey.content] = generatedPassword
|
||||||
// update cell manually, no need to call reloadData()
|
// update cell manually, no need to call reloadData()
|
||||||
|
|
|
||||||
|
|
@ -67,7 +67,7 @@ class ExtensionViewController: UIViewController, UITableViewDataSource, UITableV
|
||||||
for provider in itemProviders {
|
for provider in itemProviders {
|
||||||
// search using the extensionContext inputs
|
// search using the extensionContext inputs
|
||||||
if provider.hasItemConformingToTypeIdentifier(OnePasswordExtensionActions.findLogin) {
|
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
|
let dictionary = item as! NSDictionary
|
||||||
var url: String?
|
var url: String?
|
||||||
if var urlString = dictionary[OnePasswordExtensionKey.URLStringKey] as? 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) {
|
} 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?
|
var url: String?
|
||||||
if let dictionary = item as? NSDictionary,
|
if let dictionary = item as? NSDictionary,
|
||||||
let results = dictionary[NSExtensionJavaScriptPreprocessingResultsKey] as? NSDictionary,
|
let results = dictionary[NSExtensionJavaScriptPreprocessingResultsKey] as? NSDictionary,
|
||||||
|
|
@ -104,7 +104,7 @@ class ExtensionViewController: UIViewController, UITableViewDataSource, UITableV
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if provider.hasItemConformingToTypeIdentifier(kUTTypeURL as String) {
|
} 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
|
let url = (item as? NSURL)!.host
|
||||||
DispatchQueue.main.async { [weak self] in
|
DispatchQueue.main.async { [weak self] in
|
||||||
self?.extensionAction = .fillBrowser
|
self?.extensionAction = .fillBrowser
|
||||||
|
|
|
||||||
|
|
@ -193,7 +193,7 @@ open class PasscodeLockViewController: UIViewController, UITextFieldDelegate {
|
||||||
func forgotPasscodeButtonPressedAction(_: UIButton) {
|
func forgotPasscodeButtonPressedAction(_: UIButton) {
|
||||||
let alert = UIAlertController(title: "ResetPass".localize(), message: "ResetPassExplanation.".localize(), preferredStyle: UIAlertController.Style.alert)
|
let alert = UIAlertController(title: "ResetPass".localize(), message: "ResetPassExplanation.".localize(), preferredStyle: UIAlertController.Style.alert)
|
||||||
alert.addAction(
|
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()
|
let myContext = LAContext()
|
||||||
var error: NSError?
|
var error: NSError?
|
||||||
// If the device passcode is not set, reset the app.
|
// 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 {
|
public func credentialProvider(requestCredentialPassword: @escaping (Credential, String?) -> String?) throws -> GTCredentialProvider {
|
||||||
var attempts = 0
|
var attempts = 0
|
||||||
return GTCredentialProvider { (_, _, _) -> (GTCredential?) in
|
return GTCredentialProvider { _, _, _ -> (GTCredential?) in
|
||||||
var credential: GTCredential?
|
var credential: GTCredential?
|
||||||
|
|
||||||
switch self.credential {
|
switch self.credential {
|
||||||
|
|
|
||||||
|
|
@ -270,7 +270,7 @@ public class PasswordStore {
|
||||||
do {
|
do {
|
||||||
var q = try fm.contentsOfDirectory(atPath: storeURL.path)
|
var q = try fm.contentsOfDirectory(atPath: storeURL.path)
|
||||||
.filter { !$0.hasPrefix(".") }
|
.filter { !$0.hasPrefix(".") }
|
||||||
.map { (filename) -> PasswordEntity in
|
.map { filename -> PasswordEntity in
|
||||||
let passwordEntity = NSEntityDescription.insertNewObject(forEntityName: "PasswordEntity", into: context) as! PasswordEntity
|
let passwordEntity = NSEntityDescription.insertNewObject(forEntityName: "PasswordEntity", into: context) as! PasswordEntity
|
||||||
if filename.hasSuffix(".gpg") {
|
if filename.hasSuffix(".gpg") {
|
||||||
passwordEntity.name = String(filename.prefix(upTo: filename.index(filename.endIndex, offsetBy: -4)))
|
passwordEntity.name = String(filename.prefix(upTo: filename.index(filename.endIndex, offsetBy: -4)))
|
||||||
|
|
@ -294,7 +294,7 @@ public class PasswordStore {
|
||||||
e.isDir = true
|
e.isDir = true
|
||||||
let files = try fm.contentsOfDirectory(atPath: filePath)
|
let files = try fm.contentsOfDirectory(atPath: filePath)
|
||||||
.filter { !$0.hasPrefix(".") }
|
.filter { !$0.hasPrefix(".") }
|
||||||
.map { (filename) -> PasswordEntity in
|
.map { filename -> PasswordEntity in
|
||||||
let passwordEntity = NSEntityDescription.insertNewObject(forEntityName: "PasswordEntity", into: context) as! PasswordEntity
|
let passwordEntity = NSEntityDescription.insertNewObject(forEntityName: "PasswordEntity", into: context) as! PasswordEntity
|
||||||
if filename.hasSuffix(".gpg") {
|
if filename.hasSuffix(".gpg") {
|
||||||
passwordEntity.name = String(filename.prefix(upTo: filename.index(filename.endIndex, offsetBy: -4)))
|
passwordEntity.name = String(filename.prefix(upTo: filename.index(filename.endIndex, offsetBy: -4)))
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ import XCTest
|
||||||
|
|
||||||
class PasswordStoreTest: XCTestCase {
|
class PasswordStoreTest: XCTestCase {
|
||||||
let cloneOptions: [String: GTCredentialProvider] = {
|
let cloneOptions: [String: GTCredentialProvider] = {
|
||||||
let credentialProvider = GTCredentialProvider { (_, _, _) -> (GTCredential?) in
|
let credentialProvider = GTCredentialProvider { _, _, _ -> (GTCredential?) in
|
||||||
try? GTCredential(userName: "", password: "")
|
try? GTCredential(userName: "", password: "")
|
||||||
}
|
}
|
||||||
return [GTRepositoryCloneOptionsCredentialProvider: credentialProvider]
|
return [GTRepositoryCloneOptionsCredentialProvider: credentialProvider]
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue