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

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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