Fix various SwiftLint warnings.

This commit is contained in:
Brent Simmons committed 2026-01-02 15:05:23 -08:00
1 parent e45490fb1e
commit 9180ec3ecd
20 files changed
+41 -32

No files matched your search

@@ -208,7 +208,7 @@ extension DetailWebViewController: WKNavigationDelegate, WKUIDelegate {
decisionHandler(.cancel)
return
}
decisionHandler(.allow)
}
@@ -91,7 +91,7 @@ final class SidebarCell: NSTableCellView {
commonInit()
}
required init?(coder: NSCoder) {
required init?(coder: NSCoder) {
super.init(coder: coder)
commonInit()
}
@@ -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
@@ -65,7 +65,7 @@ final class TimelineTableCellView: NSTableCellView {
commonInit()
}
required init?(coder: NSCoder) {
required init?(coder: NSCoder) {
super.init(coder: coder)
commonInit()
}
@@ -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
}
@@ -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..<searchString.endIndex, options: .byWords) { (word, range, enclosingRange, stop) in
guard let word = word else {
searchString.enumerateSubstrings(in: searchString.startIndex..<searchString.endIndex, options: .byWords) { (word, _, _, stop) in
guard let word else {
return
}
s += word
@@ -241,4 +241,3 @@ private extension MultilineTextFieldSizer {
}
#endif
@@ -29,11 +29,24 @@ public struct ParsedItem: Hashable, Sendable {
public let tags: Set<String>?
public let attachments: Set<ParsedAttachment>?
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<ParsedAuthor>?,
tags: Set<String>?, attachments: Set<ParsedAttachment>?) {
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<ParsedAuthor>?,
tags: Set<String>?,
attachments: Set<ParsedAttachment>?) {
self.syncServiceID = syncServiceID
self.uniqueID = uniqueID
self.feedURL = feedURL
@@ -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&param2=some%20thing`.
var urlQueryString: String? {
@@ -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
@@ -308,7 +308,7 @@ private extension DownloadSession {
var currentURL = url
while(true) {
while true {
if let oneRedirectURL = redirectCache[currentURL] {
@@ -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"
@@ -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) {
+1 -3
View File
@@ -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
}
}
+1 -1
View File
@@ -45,7 +45,7 @@ final class OpenInBrowserActivity: UIActivity {
Task { @MainActor in
UIApplication.shared.open(url, options: [:], completionHandler: nil)
}
activityDidFinish(true)
}
}
+1 -1
View File
@@ -19,7 +19,7 @@ import Account
feedsHidingReadArticles = stateRestorationInfo.feedsHidingReadArticles
foldersShowingReadArticles = stateRestorationInfo.foldersShowingReadArticles
}
func save() {
saveSmartFeedsHidingReadArticles()
saveFeedsHidingReadArticles()
+2 -3
View File
@@ -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)
@@ -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)
}
@@ -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)
}
@@ -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)