From 70d605e412739cf3537bd647b36cf51221412487 Mon Sep 17 00:00:00 2001 From: Danny Moesch Date: Sun, 5 Jul 2020 22:46:21 +0200 Subject: [PATCH] Keep SwiftLint rule 'prefixed_toplevel_constant' disabled --- .swiftlint.yml | 2 +- pass/Controllers/PasswordsViewController.swift | 10 ++++------ 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/.swiftlint.yml b/.swiftlint.yml index 3100308..5cb065e 100644 --- a/.swiftlint.yml +++ b/.swiftlint.yml @@ -124,7 +124,7 @@ whitelist_rules: - override_in_extension - pattern_matching_keywords - prefer_self_type_over_type_of_self -# - prefixed_toplevel_constant +# - prefixed_toplevel_constant # Violations are mostly in test code. # - private_action # - private_outlet - private_over_fileprivate diff --git a/pass/Controllers/PasswordsViewController.swift b/pass/Controllers/PasswordsViewController.swift index 3bb67f5..f62c6d4 100644 --- a/pass/Controllers/PasswordsViewController.swift +++ b/pass/Controllers/PasswordsViewController.swift @@ -10,9 +10,10 @@ import passKit import SVProgressHUD import UIKit -private let hideSectionHeaderThreshold = 6 // hide section header if passwords count is less than the threshold - class PasswordsViewController: UIViewController, UITableViewDataSource, UITableViewDelegate, UITabBarControllerDelegate, UISearchBarDelegate { + // Arbitrary threshold to decide whether to show folders or not for only a few entries. + private static let hideSectionHeaderThreshold = 6 + private var passwordsTableEntries: [PasswordTableEntry] = [] private var passwordsTableAllEntries: [PasswordTableEntry] = [] private var parentPasswordEntity: PasswordEntity? @@ -437,10 +438,7 @@ class PasswordsViewController: UIViewController, UITableViewDataSource, UITableV } private func hideSectionHeader() -> Bool { - if passwordsTableEntries.count < hideSectionHeaderThreshold || searchController.isActive { - return true - } - return false + return passwordsTableEntries.count < Self.hideSectionHeaderThreshold || searchController.isActive } func tableView(_: UITableView, titleForHeaderInSection section: Int) -> String? {