Enable SwiftLint rule 'private_action' and fix all violations

This commit is contained in:
Danny Moesch 2020-07-05 22:49:53 +02:00 committed by Mingshen Sun
parent 70d605e412
commit fe380d4d65
17 changed files with 23 additions and 23 deletions

View file

@ -125,7 +125,7 @@ whitelist_rules:
- pattern_matching_keywords - pattern_matching_keywords
- prefer_self_type_over_type_of_self - prefer_self_type_over_type_of_self
# - prefixed_toplevel_constant # Violations are mostly in test code. # - prefixed_toplevel_constant # Violations are mostly in test code.
# - private_action - private_action
# - private_outlet # - private_outlet
- private_over_fileprivate - private_over_fileprivate
- private_unit_test - private_unit_test

View file

@ -85,7 +85,7 @@ class AdvancedSettingsTableViewController: UITableViewController {
} }
@IBAction @IBAction
func saveGitConfigSetting(segue: UIStoryboardSegue) { private func saveGitConfigSetting(segue: UIStoryboardSegue) {
if let controller = segue.source as? GitConfigSettingsTableViewController { if let controller = segue.source as? GitConfigSettingsTableViewController {
if let gitSignatureName = controller.nameTextField.text, if let gitSignatureName = controller.nameTextField.text,
let gitSignatureEmail = controller.emailTextField.text { let gitSignatureEmail = controller.emailTextField.text {

View file

@ -110,7 +110,7 @@ class GitRepositorySettingsTableViewController: UITableViewController {
// MARK: - Segue Handlers // MARK: - Segue Handlers
@IBAction @IBAction
func save(_: Any) { private func save(_: Any) {
guard let gitURLTextFieldText = gitURLTextField.text, let gitURL = URL(string: gitURLTextFieldText.trimmed) else { guard let gitURLTextFieldText = gitURLTextField.text, let gitURL = URL(string: gitURLTextFieldText.trimmed) else {
Utils.alert(title: "CannotSave".localize(), message: "SetGitRepositoryUrl".localize(), controller: self) Utils.alert(title: "CannotSave".localize(), message: "SetGitRepositoryUrl".localize(), controller: self)
return return
@ -224,7 +224,7 @@ class GitRepositorySettingsTableViewController: UITableViewController {
} }
@IBAction @IBAction
func importSSHKey(segue: UIStoryboardSegue) { private func importSSHKey(segue: UIStoryboardSegue) {
guard let sourceController = segue.source as? KeyImporter, sourceController.isReadyToUse() else { guard let sourceController = segue.source as? KeyImporter, sourceController.isReadyToUse() else {
return return
} }

View file

@ -33,7 +33,7 @@ class PGPKeyArmorImportTableViewController: AutoCellHeightUITableViewController,
} }
@IBAction @IBAction
func save(_: Any) { private func save(_: Any) {
armorPublicKey = armorPublicKeyTextView.text armorPublicKey = armorPublicKeyTextView.text
armorPrivateKey = armorPrivateKeyTextView.text armorPrivateKey = armorPrivateKeyTextView.text
saveImportedKeys() saveImportedKeys()

View file

@ -19,7 +19,7 @@ class PGPKeyFileImportTableViewController: AutoCellHeightUITableViewController {
private var currentlyPicking = KeyType.none private var currentlyPicking = KeyType.none
@IBAction @IBAction
func save(_: Any) { private func save(_: Any) {
saveImportedKeys() saveImportedKeys()
} }

View file

@ -23,7 +23,7 @@ class PGPKeyUrlImportTableViewController: AutoCellHeightUITableViewController {
} }
@IBAction @IBAction
func save(_: Any) { private func save(_: Any) {
guard let publicKeyURLText = pgpPublicKeyURLTextField.text, guard let publicKeyURLText = pgpPublicKeyURLTextField.text,
let publicKeyURL = URL(string: publicKeyURLText), let publicKeyURL = URL(string: publicKeyURLText),
let privateKeyURLText = pgpPrivateKeyURLTextField.text, let privateKeyURLText = pgpPrivateKeyURLTextField.text,

View file

@ -344,7 +344,7 @@ class PasswordDetailTableViewController: UITableViewController, UIGestureRecogni
} }
@IBAction @IBAction
func back(segue _: UIStoryboardSegue) {} private func back(segue _: UIStoryboardSegue) {}
func getNextHOTP() { func getNextHOTP() {
guard password != nil, passwordEntity != nil, password?.otpType == .hotp else { guard password != nil, passwordEntity != nil, password?.otpType == .hotp else {

View file

@ -137,10 +137,10 @@ class PasswordsViewController: UIViewController, UITableViewDataSource, UITableV
} }
@IBAction @IBAction
func cancelAddPassword(segue _: UIStoryboardSegue) {} private func cancelAddPassword(segue _: UIStoryboardSegue) {}
@IBAction @IBAction
func saveAddPassword(segue: UIStoryboardSegue) { private func saveAddPassword(segue: UIStoryboardSegue) {
if let controller = segue.source as? AddPasswordTableViewController { if let controller = segue.source as? AddPasswordTableViewController {
addPassword(password: controller.password!) addPassword(password: controller.password!)
} }
@ -438,7 +438,7 @@ class PasswordsViewController: UIViewController, UITableViewDataSource, UITableV
} }
private func hideSectionHeader() -> Bool { private func hideSectionHeader() -> Bool {
return passwordsTableEntries.count < Self.hideSectionHeaderThreshold || searchController.isActive passwordsTableEntries.count < Self.hideSectionHeaderThreshold || searchController.isActive
} }
func tableView(_: UITableView, titleForHeaderInSection section: Int) -> String? { func tableView(_: UITableView, titleForHeaderInSection section: Int) -> String? {

View file

@ -60,7 +60,7 @@ class SSHKeyArmorImportTableViewController: AutoCellHeightUITableViewController,
} }
@IBAction @IBAction
func doneButtonTapped(_: Any) { private func doneButtonTapped(_: Any) {
armorPrivateKey = armorPrivateKeyTextView.text armorPrivateKey = armorPrivateKeyTextView.text
performSegue(withIdentifier: "importSSHKeySegue", sender: self) performSegue(withIdentifier: "importSSHKeySegue", sender: self)
} }

View file

@ -15,7 +15,7 @@ class SSHKeyFileImportTableViewController: AutoCellHeightUITableViewController {
private var privateKey: String? private var privateKey: String?
@IBAction @IBAction
func doneButtonTapped(_: Any) { private func doneButtonTapped(_: Any) {
performSegue(withIdentifier: "importSSHKeySegue", sender: self) performSegue(withIdentifier: "importSSHKeySegue", sender: self)
} }

View file

@ -20,7 +20,7 @@ class SSHKeyUrlImportTableViewController: AutoCellHeightUITableViewController {
} }
@IBAction @IBAction
func doneButtonTapped(_: UIButton) { private func doneButtonTapped(_: UIButton) {
guard let text = privateKeyURLTextField.text, guard let text = privateKeyURLTextField.text,
let privateKeyURL = URL(string: text) else { let privateKeyURL = URL(string: text) else {
Utils.alert(title: "CannotSave".localize(), message: "SetPrivateKeyUrl.".localize(), controller: self) Utils.alert(title: "CannotSave".localize(), message: "SetPrivateKeyUrl.".localize(), controller: self)

View file

@ -26,7 +26,7 @@ class SettingsTableViewController: UITableViewController, UITabBarControllerDele
} }
@IBAction @IBAction
func savePGPKey(segue: UIStoryboardSegue) { private func savePGPKey(segue: UIStoryboardSegue) {
guard let sourceController = segue.source as? PGPKeyImporter, sourceController.isReadyToUse() else { guard let sourceController = segue.source as? PGPKeyImporter, sourceController.isReadyToUse() else {
return return
} }
@ -60,7 +60,7 @@ class SettingsTableViewController: UITableViewController, UITabBarControllerDele
} }
@IBAction @IBAction
func saveGitServerSetting(segue _: UIStoryboardSegue) { private func saveGitServerSetting(segue _: UIStoryboardSegue) {
passwordRepositoryTableViewCell.detailTextLabel?.text = Defaults.gitURL.host passwordRepositoryTableViewCell.detailTextLabel?.text = Defaults.gitURL.host
} }

View file

@ -32,18 +32,18 @@ class FillPasswordTableViewCell: UITableViewCell, ContentProvider {
} }
@IBAction @IBAction
func generatePassword(_: UIButton) { private func generatePassword(_: UIButton) {
delegate?.generateAndCopyPassword() delegate?.generateAndCopyPassword()
} }
@IBAction @IBAction
func showHidePasswordSettings() { private func showHidePasswordSettings() {
delegate?.showHidePasswordSettings() delegate?.showHidePasswordSettings()
} }
// re-color // re-color
@IBAction @IBAction
func textFieldDidChange(_ sender: UITextField) { private func textFieldDidChange(_ sender: UITextField) {
contentTextField.attributedText = Utils.attributedPassword(plainPassword: sender.text ?? "") contentTextField.attributedText = Utils.attributedPassword(plainPassword: sender.text ?? "")
} }

View file

@ -20,7 +20,7 @@ class SliderTableViewCell: UITableViewCell {
private var delegate: PasswordSettingSliderTableViewCellDelegate! private var delegate: PasswordSettingSliderTableViewCellDelegate!
@IBAction @IBAction
func handleSliderValueChange(_ sender: UISlider) { private func handleSliderValueChange(_ sender: UISlider) {
let newRoundedValue = Int(sender.value) let newRoundedValue = Int(sender.value)
// Proceed only if the rounded value gets updated. // Proceed only if the rounded value gets updated.
guard checker(newRoundedValue) else { guard checker(newRoundedValue) else {

View file

@ -18,7 +18,7 @@ class SwitchTableViewCell: UITableViewCell {
private var delegate: PasswordSettingSliderTableViewCellDelegate! private var delegate: PasswordSettingSliderTableViewCellDelegate!
@IBAction @IBAction
func switchValueChanged(_: Any) { private func switchValueChanged(_: Any) {
updater(controlSwitch.isOn) updater(controlSwitch.isOn)
delegate.generateAndCopyPassword() delegate.generateAndCopyPassword()
} }

View file

@ -83,7 +83,7 @@ class CredentialProviderViewController: ASCredentialProviderViewController, UITa
*/ */
@IBAction @IBAction
func cancel(_: AnyObject?) { private func cancel(_: AnyObject?) {
extensionContext.cancelRequest(withError: NSError(domain: ASExtensionErrorDomain, code: ASExtensionError.userCanceled.rawValue)) extensionContext.cancelRequest(withError: NSError(domain: ASExtensionErrorDomain, code: ASExtensionError.userCanceled.rawValue))
} }

View file

@ -214,7 +214,7 @@ class ExtensionViewController: UIViewController, UITableViewDataSource, UITableV
} }
@IBAction @IBAction
func cancelExtension(_: Any) { private func cancelExtension(_: Any) {
extensionContext!.completeRequest(returningItems: [], completionHandler: nil) extensionContext!.completeRequest(returningItems: [], completionHandler: nil)
} }