From 08473f8f05b9ade66c6dd71fc9696e3dc26003f5 Mon Sep 17 00:00:00 2001 From: Danny Moesch Date: Sat, 4 Jul 2020 21:57:26 +0200 Subject: [PATCH] Enable SwiftLint rule 'conditional_returns_on_newline' and fix all violations --- .swiftlint.yml | 2 +- pass/Controllers/PasswordsViewController.swift | 16 ++++++++++++---- passKit/Controllers/PasscodeLockPresenter.swift | 4 +++- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/.swiftlint.yml b/.swiftlint.yml index 355eec3..1f4ac21 100644 --- a/.swiftlint.yml +++ b/.swiftlint.yml @@ -20,7 +20,7 @@ whitelist_rules: - colon - comma - compiler_protocol_init -# - conditional_returns_on_newline + - conditional_returns_on_newline - contains_over_filter_count - contains_over_filter_is_empty # - contains_over_first_not_nil diff --git a/pass/Controllers/PasswordsViewController.swift b/pass/Controllers/PasswordsViewController.swift index 8c1c20b..7221d53 100644 --- a/pass/Controllers/PasswordsViewController.swift +++ b/pass/Controllers/PasswordsViewController.swift @@ -283,8 +283,12 @@ class PasswordsViewController: UIViewController, UITableViewDataSource, UITableV func didTapNavigationBar(_ sender: UITapGestureRecognizer) { let location = sender.location(in: navigationController?.navigationBar) let hitView = navigationController?.navigationBar.hitTest(location, with: nil) - guard !(hitView is UIControl) else { return } - guard passwordStore.numberOfLocalCommits != 0 else { return } + guard !(hitView is UIControl) else { + return + } + guard passwordStore.numberOfLocalCommits != 0 else { + return + } let ac = UIAlertController(title: nil, message: nil, preferredStyle: .actionSheet) let allAction = UIAlertAction(title: "All Passwords", style: .default) { _ in @@ -405,7 +409,9 @@ class PasswordsViewController: UIViewController, UITableViewDataSource, UITableV @objc func backAction(_: Any?) { - guard Defaults.isShowFolderOn else { return } + guard Defaults.isShowFolderOn else { + return + } var anim: CATransition? = transitionFromLeft if parentPasswordEntity == nil { anim = nil @@ -640,7 +646,9 @@ class PasswordsViewController: UIViewController, UITableViewDataSource, UITableV @objc func actOnReloadTableViewRelatedNotification() { DispatchQueue.main.async { [weak weakSelf = self] in - guard let strongSelf = weakSelf else { return } + guard let strongSelf = weakSelf else { + return + } // Reset selectedScopeButtonIndex to make sure the correct reloadTableView strongSelf.searchController.searchBar.selectedScopeButtonIndex = 0 strongSelf.initPasswordsTableEntries(parent: nil) diff --git a/passKit/Controllers/PasscodeLockPresenter.swift b/passKit/Controllers/PasscodeLockPresenter.swift index f6aab67..ee54f6c 100644 --- a/passKit/Controllers/PasscodeLockPresenter.swift +++ b/passKit/Controllers/PasscodeLockPresenter.swift @@ -19,7 +19,9 @@ open class PasscodeLockPresenter { } open func present(windowLevel: CGFloat?) { - guard PasscodeLock.shared.hasPasscode else { return } + guard PasscodeLock.shared.hasPasscode else { + return + } // dismiss the original window dismiss()