From 9180ec3ecdc4a2d7a42013173c60be193d5a99fa Mon Sep 17 00:00:00 2001 From: Brent Simmons Date: Fri, 2 Jan 2026 15:05:23 -0800 Subject: [PATCH] Fix various SwiftLint warnings. --- .../Detail/DetailWebViewController.swift | 2 +- Mac/MainWindow/Sidebar/Cell/SidebarCell.swift | 2 +- .../Sidebar/SidebarOutlineDataSource.swift | 2 +- .../Timeline/Cell/TimelineTableCellView.swift | 2 +- .../NSApplication+Scriptability.swift | 4 ++-- .../ArticlesDatabase/ArticlesTable.swift | 6 ++--- .../AppKit/MultilineTextFieldSizer.swift | 1 - .../Sources/Swift/Feeds/ParsedItem.swift | 23 +++++++++++++++---- .../Sources/RSWeb/Dictionary+RSWeb.swift | 2 +- .../Sources/RSWeb/DownloadProgress.swift | 2 +- .../RSWeb/Sources/RSWeb/DownloadSession.swift | 2 +- .../RSWeb/Sources/RSWeb/MacWebBrowser.swift | 2 +- .../FeedbinAccountViewController.swift | 2 +- iOS/Add/AddFolderViewController.swift | 4 +--- iOS/Article/OpenInSafariActivity.swift | 2 +- iOS/HidingReadArticlesState.swift | 2 +- iOS/MainFeed/RefreshProgressView.swift | 5 ++-- .../Cells/MainTimelineFeedCell.swift | 4 ++-- .../Cells/MainTimelineIconFeedCell.swift | 2 +- .../UIActivityViewController+Extras.swift | 2 +- 20 files changed, 41 insertions(+), 32 deletions(-) diff --git a/Mac/MainWindow/Detail/DetailWebViewController.swift b/Mac/MainWindow/Detail/DetailWebViewController.swift index e02be2ff9..84dc41ce2 100644 --- a/Mac/MainWindow/Detail/DetailWebViewController.swift +++ b/Mac/MainWindow/Detail/DetailWebViewController.swift @@ -208,7 +208,7 @@ extension DetailWebViewController: WKNavigationDelegate, WKUIDelegate { decisionHandler(.cancel) return } - + decisionHandler(.allow) } diff --git a/Mac/MainWindow/Sidebar/Cell/SidebarCell.swift b/Mac/MainWindow/Sidebar/Cell/SidebarCell.swift index d582caa99..22ea6a6e9 100644 --- a/Mac/MainWindow/Sidebar/Cell/SidebarCell.swift +++ b/Mac/MainWindow/Sidebar/Cell/SidebarCell.swift @@ -91,7 +91,7 @@ final class SidebarCell: NSTableCellView { commonInit() } - required init?(coder: NSCoder) { + required init?(coder: NSCoder) { super.init(coder: coder) commonInit() } diff --git a/Mac/MainWindow/Sidebar/SidebarOutlineDataSource.swift b/Mac/MainWindow/Sidebar/SidebarOutlineDataSource.swift index 8b6a97956..4031874cb 100644 --- a/Mac/MainWindow/Sidebar/SidebarOutlineDataSource.swift +++ b/Mac/MainWindow/Sidebar/SidebarOutlineDataSource.swift @@ -442,7 +442,7 @@ private extension SidebarOutlineDataSource { Task { @MainActor in do { let destinationFolder = try await destinationAccount.addFolder(folder.name ?? "") - + for feed in folder.topLevelFeeds { if let existingFeed = destinationAccount.existingFeed(withURL: feed.url) { destinationAccount.addFeed(existingFeed, to: destinationFolder) { result in diff --git a/Mac/MainWindow/Timeline/Cell/TimelineTableCellView.swift b/Mac/MainWindow/Timeline/Cell/TimelineTableCellView.swift index cbafeda5b..0c2ed3618 100644 --- a/Mac/MainWindow/Timeline/Cell/TimelineTableCellView.swift +++ b/Mac/MainWindow/Timeline/Cell/TimelineTableCellView.swift @@ -65,7 +65,7 @@ final class TimelineTableCellView: NSTableCellView { commonInit() } - required init?(coder: NSCoder) { + required init?(coder: NSCoder) { super.init(coder: coder) commonInit() } diff --git a/Mac/Scripting/NSApplication+Scriptability.swift b/Mac/Scripting/NSApplication+Scriptability.swift index 0657dddce..e745f342d 100644 --- a/Mac/Scripting/NSApplication+Scriptability.swift +++ b/Mac/Scripting/NSApplication+Scriptability.swift @@ -12,8 +12,8 @@ import Articles extension NSApplication: @preconcurrency ScriptingObjectContainer { // MARK: - ScriptingObjectContainer protocol - - nonisolated var scriptingClassDescription: NSScriptClassDescription { + + nonisolated var scriptingClassDescription: NSScriptClassDescription { return self.classDescription as! NSScriptClassDescription } diff --git a/Modules/ArticlesDatabase/Sources/ArticlesDatabase/ArticlesTable.swift b/Modules/ArticlesDatabase/Sources/ArticlesDatabase/ArticlesTable.swift index 467c9906b..ef48b4412 100644 --- a/Modules/ArticlesDatabase/Sources/ArticlesDatabase/ArticlesTable.swift +++ b/Modules/ArticlesDatabase/Sources/ArticlesDatabase/ArticlesTable.swift @@ -735,7 +735,7 @@ nonisolated private extension ArticlesTable { private func fetchArticlesCount(_ fetchMethod: @escaping ArticlesCountFetchMethod) throws -> Int { nonisolated(unsafe) var articlesCount = 0 nonisolated(unsafe) var error: DatabaseError? = nil - + queue.runInDatabaseSync { databaseResult in switch databaseResult { case .success(let database): @@ -859,8 +859,8 @@ nonisolated private extension ArticlesTable { func sqliteSearchString(with searchString: String) -> String { var s = "" - searchString.enumerateSubstrings(in: searchString.startIndex..? public let attachments: Set? - public init(syncServiceID: String?, uniqueID: String, feedURL: String, url: String?, externalURL: String?, title: String?, - language: String?, contentHTML: String?, contentText: String?, markdown: String?, summary: String?, imageURL: String?, - bannerImageURL: String?,datePublished: Date?, dateModified: Date?, authors: Set?, - tags: Set?, attachments: Set?) { - + public init(syncServiceID: String?, + uniqueID: String, + feedURL: String, + url: String?, + externalURL: String?, + title: String?, + language: String?, + contentHTML: String?, + contentText: String?, + markdown: String?, + summary: String?, + imageURL: String?, + bannerImageURL: String?, + datePublished: Date?, + dateModified: Date?, + authors: Set?, + tags: Set?, + attachments: Set?) { self.syncServiceID = syncServiceID self.uniqueID = uniqueID self.feedURL = feedURL diff --git a/Modules/RSWeb/Sources/RSWeb/Dictionary+RSWeb.swift b/Modules/RSWeb/Sources/RSWeb/Dictionary+RSWeb.swift index c244174a6..33722c902 100644 --- a/Modules/RSWeb/Sources/RSWeb/Dictionary+RSWeb.swift +++ b/Modules/RSWeb/Sources/RSWeb/Dictionary+RSWeb.swift @@ -8,7 +8,7 @@ import Foundation -nonisolated public extension Dictionary where Key == String, Value == String { +nonisolated public extension Dictionary where Key == String, Value == String { /// Translates a dictionary into a string like `foo=bar¶m2=some%20thing`. var urlQueryString: String? { diff --git a/Modules/RSWeb/Sources/RSWeb/DownloadProgress.swift b/Modules/RSWeb/Sources/RSWeb/DownloadProgress.swift index 077fa9d05..2eae82b1b 100755 --- a/Modules/RSWeb/Sources/RSWeb/DownloadProgress.swift +++ b/Modules/RSWeb/Sources/RSWeb/DownloadProgress.swift @@ -150,7 +150,7 @@ nonisolated public final class DownloadProgress: Hashable, Sendable { hasher.combine(id) } - // MARK - Equatable + // MARK: - Equatable public static func ==(lhs: DownloadProgress, rhs: DownloadProgress) -> Bool { lhs.id == rhs.id diff --git a/Modules/RSWeb/Sources/RSWeb/DownloadSession.swift b/Modules/RSWeb/Sources/RSWeb/DownloadSession.swift index 4937f71a0..75953b7ce 100755 --- a/Modules/RSWeb/Sources/RSWeb/DownloadSession.swift +++ b/Modules/RSWeb/Sources/RSWeb/DownloadSession.swift @@ -308,7 +308,7 @@ private extension DownloadSession { var currentURL = url - while(true) { + while true { if let oneRedirectURL = redirectCache[currentURL] { diff --git a/Modules/RSWeb/Sources/RSWeb/MacWebBrowser.swift b/Modules/RSWeb/Sources/RSWeb/MacWebBrowser.swift index c187f842f..0db15ed6a 100755 --- a/Modules/RSWeb/Sources/RSWeb/MacWebBrowser.swift +++ b/Modules/RSWeb/Sources/RSWeb/MacWebBrowser.swift @@ -146,7 +146,7 @@ import UniformTypeIdentifiers extension MacWebBrowser: CustomDebugStringConvertible { public var debugDescription: String { - if let name = name, let bundleIdentifier = bundleIdentifier{ + if let name, let bundleIdentifier { return "MacWebBrowser: \(name) (\(bundleIdentifier))" } else { return "MacWebBrowser" diff --git a/iOS/Account/FeedbinAccountViewController.swift b/iOS/Account/FeedbinAccountViewController.swift index cecbdc553..968d82666 100644 --- a/iOS/Account/FeedbinAccountViewController.swift +++ b/iOS/Account/FeedbinAccountViewController.swift @@ -149,7 +149,7 @@ final class FeedbinAccountViewController: UITableViewController { } @objc func textDidChange(_ note: Notification) { - actionButton.isEnabled = !(emailTextField.text?.isEmpty ?? false) && !(passwordTextField.text?.isEmpty ?? false) + actionButton.isEnabled = !(emailTextField.text?.isEmpty ?? false) && !(passwordTextField.text?.isEmpty ?? false) } private func showError(_ message: String) { diff --git a/iOS/Add/AddFolderViewController.swift b/iOS/Add/AddFolderViewController.swift index daec8ef3d..eeb1c2931 100644 --- a/iOS/Add/AddFolderViewController.swift +++ b/iOS/Add/AddFolderViewController.swift @@ -102,7 +102,7 @@ final class AddFolderViewController: UITableViewController { return defaultNumberOfRows - 1 } - return defaultNumberOfRows + return defaultNumberOfRows } } @@ -123,7 +123,6 @@ extension AddFolderViewController: UIPickerViewDataSource, UIPickerViewDelegate func pickerView(_ pickerView: UIPickerView, didSelectRow row: Int, inComponent component: Int) { didSelect(accounts[row]) } - } extension AddFolderViewController: UITextFieldDelegate { @@ -132,5 +131,4 @@ extension AddFolderViewController: UITextFieldDelegate { textField.resignFirstResponder() return true } - } diff --git a/iOS/Article/OpenInSafariActivity.swift b/iOS/Article/OpenInSafariActivity.swift index e7a743d22..272347be8 100644 --- a/iOS/Article/OpenInSafariActivity.swift +++ b/iOS/Article/OpenInSafariActivity.swift @@ -45,7 +45,7 @@ final class OpenInBrowserActivity: UIActivity { Task { @MainActor in UIApplication.shared.open(url, options: [:], completionHandler: nil) } - + activityDidFinish(true) } } diff --git a/iOS/HidingReadArticlesState.swift b/iOS/HidingReadArticlesState.swift index 25e6b07c3..7587203c5 100644 --- a/iOS/HidingReadArticlesState.swift +++ b/iOS/HidingReadArticlesState.swift @@ -19,7 +19,7 @@ import Account feedsHidingReadArticles = stateRestorationInfo.feedsHidingReadArticles foldersShowingReadArticles = stateRestorationInfo.foldersShowingReadArticles } - + func save() { saveSmartFeedsHidingReadArticles() saveFeedsHidingReadArticles() diff --git a/iOS/MainFeed/RefreshProgressView.swift b/iOS/MainFeed/RefreshProgressView.swift index 6b2e25693..00fdb1553 100644 --- a/iOS/MainFeed/RefreshProgressView.swift +++ b/iOS/MainFeed/RefreshProgressView.swift @@ -15,17 +15,16 @@ final class RefreshProgressView: UIView { override func awakeFromNib() { MainActor.assumeIsolated { - NotificationCenter.default.addObserver(self, selector: #selector(progressDidChange(_:)), name: .combinedRefreshProgressDidChange, object: nil) NotificationCenter.default.addObserver(self, selector: #selector(contentSizeCategoryDidChange(_:)), name: UIContentSizeCategory.didChangeNotification, object: nil) update() scheduleUpdateRefreshLabel() - + isAccessibilityElement = true accessibilityTraits = [.updatesFrequently, .notEnabled] } } - + func update() { if !AccountManager.shared.combinedRefreshProgress.isComplete { progressChanged(animated: false) diff --git a/iOS/MainTimeline/Cells/MainTimelineFeedCell.swift b/iOS/MainTimeline/Cells/MainTimelineFeedCell.swift index e2d65d018..1151fc521 100644 --- a/iOS/MainTimeline/Cells/MainTimelineFeedCell.swift +++ b/iOS/MainTimeline/Cells/MainTimelineFeedCell.swift @@ -100,8 +100,8 @@ class MainTimelineFeedCell: UITableViewCell { .font: UIFont.preferredFont(forTextStyle: .headline), .paragraphStyle: paragraphStyle, .foregroundColor: isSelected ? UIColor.white : UIColor.label - ] - let titleWithNewline = cellData.title + (cellData.summary != "" ? "\n" : "" ) + ] + let titleWithNewline = cellData.title + (cellData.summary != "" ? "\n" : "" ) let titleAttributed = NSAttributedString(string: titleWithNewline, attributes: titleAttributes) attributedCellText.append(titleAttributed) } diff --git a/iOS/MainTimeline/Cells/MainTimelineIconFeedCell.swift b/iOS/MainTimeline/Cells/MainTimelineIconFeedCell.swift index 17334af29..ff2d45bce 100644 --- a/iOS/MainTimeline/Cells/MainTimelineIconFeedCell.swift +++ b/iOS/MainTimeline/Cells/MainTimelineIconFeedCell.swift @@ -127,7 +127,7 @@ class MainTimelineIconFeedCell: UITableViewCell { .paragraphStyle: paragraphStyle, .foregroundColor: isSelected ? UIColor.white : UIColor.label ] - let titleWithNewline = cellData.title + (cellData.summary != "" ? "\n" : "" ) + let titleWithNewline = cellData.title + (cellData.summary != "" ? "\n" : "" ) let titleAttributed = NSAttributedString(string: titleWithNewline, attributes: titleAttributes) attributedCellText.append(titleAttributed) } diff --git a/iOS/UIKit Extensions/UIActivityViewController+Extras.swift b/iOS/UIKit Extensions/UIActivityViewController+Extras.swift index 9a6110d95..5a1931516 100644 --- a/iOS/UIKit Extensions/UIActivityViewController+Extras.swift +++ b/iOS/UIKit Extensions/UIActivityViewController+Extras.swift @@ -11,7 +11,7 @@ import UIKit public extension UIActivityViewController { - + convenience init(url: URL, title: String?, applicationActivities: [UIActivity]?) { let itemSource = ArticleActivityItemSource(url: url, subject: title) let titleSource = TitleActivityItemSource(title: title)