From e45490fb1e93dbc632c149385f563450438cbfcb Mon Sep 17 00:00:00 2001 From: Brent Simmons Date: Fri, 2 Jan 2026 11:57:55 -0800 Subject: [PATCH] Fix various SwiftLint warnings. --- Mac/AppDefaults.swift | 6 ++---- Mac/Inspector/InspectorWindowController.swift | 6 ++---- Mac/Inspector/NothingInspectorViewController.swift | 3 +-- Mac/MainWindow/Detail/DetailStatusBarView.swift | 6 ++---- Mac/MainWindow/MainWindowController.swift | 3 +-- Mac/MainWindow/OPML/ExportOPMLWindowController.swift | 3 +-- Mac/MainWindow/Sidebar/PasteboardFeed.swift | 6 ++---- .../Sidebar/SidebarOutlineDataSource.swift | 3 +-- .../Timeline/ArticlePasteboardWriter.swift | 6 ++---- .../Timeline/Cell/TimelineCellLayout.swift | 6 ++---- .../Timeline/Cell/TimelineTableCellView.swift | 3 +-- .../Timeline/TimelineContainerViewController.swift | 3 +-- Mac/MainWindow/Timeline/TimelineViewController.swift | 12 ++++-------- Mac/Preferences/Accounts/AddAccountHelpView.swift | 3 +-- .../Advanced/AdvancedPreferencesViewController.swift | 3 +-- Mac/Preferences/PreferencesWindowController.swift | 3 +-- Mac/SafariExtension/SafariExtensionHandler.swift | 3 +-- Modules/Articles/Sources/Articles/Article.swift | 3 +-- Modules/Articles/Sources/Articles/Author.swift | 9 +++------ .../Sources/FeedFinder/HTMLFeedFinder.swift | 3 +-- .../RSCore/AppKit/MultilineTextFieldSizer.swift | 3 +-- .../Sources/RSCore/AppKit/NSOutlineView+RSCore.swift | 3 +-- .../Sources/RSCore/AppKit/NSResponder+RSCore.swift | 3 +-- Modules/RSCore/Sources/RSCore/AppKit/UserApp.swift | 9 +++------ Modules/RSCore/Sources/RSCore/BinaryDiskCache.swift | 3 +-- .../Related Objects/DatabaseLookupTable.swift | 3 +-- .../DatabaseRelatedObjectsTable.swift | 3 +-- .../Related Objects/RelatedObjectIDsMap.swift | 3 +-- .../RSParser/Sources/Swift/Feeds/FeedParser.swift | 6 ++---- .../Sources/Swift/Feeds/JSON/RSSInJSONParser.swift | 6 ++---- .../RSParser/Sources/Swift/Feeds/ParsedItem.swift | 3 +-- .../Tests/RSParserTests/AtomParserTests.swift | 3 +-- Modules/RSWeb/Sources/RSWeb/URL+RSWeb.swift | 3 +-- .../Sources/RSWeb/WebServices/TransportJSON.swift | 6 ++---- iOS/MainTimeline/Cells/MainTimelineCellData.swift | 3 +-- iOS/SceneCoordinator.swift | 6 ++---- 36 files changed, 53 insertions(+), 106 deletions(-) diff --git a/Mac/AppDefaults.swift b/Mac/AppDefaults.swift index a62b8c12d..d66319609 100644 --- a/Mac/AppDefaults.swift +++ b/Mac/AppDefaults.swift @@ -117,8 +117,7 @@ final class AppDefaults: Sendable { if let appGroupID = Bundle.main.object(forInfoDictionaryKey: "AppGroup") as? String, let appGroupDefaults = UserDefaults(suiteName: appGroupID) { return appGroupDefaults - } - else { + } else { return UserDefaults.standard } } @@ -439,8 +438,7 @@ private extension AppDefaults { static func setSortDirection(for key: String, _ value: ComparisonResult) { if value == .orderedAscending { setInt(for: key, ComparisonResult.orderedAscending.rawValue) - } - else { + } else { setInt(for: key, ComparisonResult.orderedDescending.rawValue) } } diff --git a/Mac/Inspector/InspectorWindowController.swift b/Mac/Inspector/InspectorWindowController.swift index 7082adeda..7665b0910 100644 --- a/Mac/Inspector/InspectorWindowController.swift +++ b/Mac/Inspector/InspectorWindowController.swift @@ -64,8 +64,7 @@ final class InspectorWindowController: NSWindowController { if let savedOrigin = originFromDefaults() { window?.setFlippedOriginAdjustingForScreen(savedOrigin) - } - else { + } else { window?.flippedOrigin = NSPoint(x: 256, y: 256) } } @@ -77,8 +76,7 @@ final class InspectorWindowController: NSWindowController { for inspector in inspectors { if inspector.isFallbackInspector { fallbackInspector = inspector - } - else if let objects = objects, inspector.canInspect(objects) { + } else if let objects = objects, inspector.canInspect(objects) { return inspector } } diff --git a/Mac/Inspector/NothingInspectorViewController.swift b/Mac/Inspector/NothingInspectorViewController.swift index 376e6a594..f23ad9b64 100644 --- a/Mac/Inspector/NothingInspectorViewController.swift +++ b/Mac/Inspector/NothingInspectorViewController.swift @@ -39,8 +39,7 @@ private extension NothingInspectorViewController { if let objects = objects, objects.count > 1 { nothingTextField?.isHidden = true multipleTextField?.isHidden = false - } - else { + } else { nothingTextField?.isHidden = false multipleTextField?.isHidden = true } diff --git a/Mac/MainWindow/Detail/DetailStatusBarView.swift b/Mac/MainWindow/Detail/DetailStatusBarView.swift index 62577648a..0d110e798 100644 --- a/Mac/MainWindow/Detail/DetailStatusBarView.swift +++ b/Mac/MainWindow/Detail/DetailStatusBarView.swift @@ -25,8 +25,7 @@ final class DetailStatusBarView: NSView { if let link = linkForDisplay { urlLabel.stringValue = link self.isHidden = false - } - else { + } else { urlLabel.stringValue = "" self.isHidden = true } @@ -68,8 +67,7 @@ private extension DetailStatusBarView { func updateLinkForDisplay() { if let mouseoverLink = mouseoverLink, !mouseoverLink.isEmpty { linkForDisplay = mouseoverLink.strippingHTTPOrHTTPSScheme - } - else { + } else { linkForDisplay = nil } } diff --git a/Mac/MainWindow/MainWindowController.swift b/Mac/MainWindow/MainWindowController.swift index c47b1f1ae..4a9b0fa68 100644 --- a/Mac/MainWindow/MainWindowController.swift +++ b/Mac/MainWindow/MainWindowController.swift @@ -370,8 +370,7 @@ final class MainWindowController: NSWindowController, NSUserInterfaceValidations // TODO: handle search mode if timelineViewController.canGoToNextUnread(wrappingToTop: false) { goToNextUnreadInTimeline(wrappingToTop: false) - } - else if sidebarViewController.canGoToNextUnread(wrappingToTop: true) { + } else if sidebarViewController.canGoToNextUnread(wrappingToTop: true) { sidebarViewController.goToNextUnread(wrappingToTop: true) // If we ended up on the same timelineViewController, we may need to wrap diff --git a/Mac/MainWindow/OPML/ExportOPMLWindowController.swift b/Mac/MainWindow/OPML/ExportOPMLWindowController.swift index c2ec4600e..91d365c15 100644 --- a/Mac/MainWindow/OPML/ExportOPMLWindowController.swift +++ b/Mac/MainWindow/OPML/ExportOPMLWindowController.swift @@ -96,8 +96,7 @@ final class ExportOPMLWindowController: NSWindowController { let opmlString = OPMLExporter.OPMLString(with: account, title: filename) do { try opmlString.write(to: url, atomically: true, encoding: String.Encoding.utf8) - } - catch let error as NSError { + } catch let error as NSError { NSApplication.shared.presentError(error) } } diff --git a/Mac/MainWindow/Sidebar/PasteboardFeed.swift b/Mac/MainWindow/Sidebar/PasteboardFeed.swift index 63880f262..50f109889 100644 --- a/Mac/MainWindow/Sidebar/PasteboardFeed.swift +++ b/Mac/MainWindow/Sidebar/PasteboardFeed.swift @@ -76,8 +76,7 @@ struct PasteboardFeed: Hashable { var pasteboardType: NSPasteboard.PasteboardType? if pasteboardItem.types.contains(FeedPasteboardWriter.feedUTIInternalType) { pasteboardType = FeedPasteboardWriter.feedUTIInternalType - } - else if pasteboardItem.types.contains(FeedPasteboardWriter.feedUTIType) { + } else if pasteboardItem.types.contains(FeedPasteboardWriter.feedUTIType) { pasteboardType = FeedPasteboardWriter.feedUTIType } if let foundType = pasteboardType { @@ -91,8 +90,7 @@ struct PasteboardFeed: Hashable { // Check for URL or a string that may be a URL. if pasteboardItem.types.contains(.URL) { pasteboardType = .URL - } - else if pasteboardItem.types.contains(.string) { + } else if pasteboardItem.types.contains(.string) { pasteboardType = .string } if let foundType = pasteboardType { diff --git a/Mac/MainWindow/Sidebar/SidebarOutlineDataSource.swift b/Mac/MainWindow/Sidebar/SidebarOutlineDataSource.swift index 33ad61f87..8b6a97956 100644 --- a/Mac/MainWindow/Sidebar/SidebarOutlineDataSource.swift +++ b/Mac/MainWindow/Sidebar/SidebarOutlineDataSource.swift @@ -167,8 +167,7 @@ private extension SidebarOutlineDataSource { for feed in draggedFeeds { if feed.isLocalFeed { hasLocalFeed = true - } - else { + } else { hasNonLocalFeed = true } if hasLocalFeed && hasNonLocalFeed { diff --git a/Mac/MainWindow/Timeline/ArticlePasteboardWriter.swift b/Mac/MainWindow/Timeline/ArticlePasteboardWriter.swift index b48847849..3308f8148 100644 --- a/Mac/MainWindow/Timeline/ArticlePasteboardWriter.swift +++ b/Mac/MainWindow/Timeline/ArticlePasteboardWriter.swift @@ -78,11 +78,9 @@ private extension ArticlePasteboardWriter { } if let text = article.contentText { s += "\(text)\n\n" - } - else if let summary = article.summary { + } else if let summary = article.summary { s += "\(summary)\n\n" - } - else if let html = article.contentHTML { + } else if let html = article.contentHTML { let convertedHTML = html.convertingToPlainText() s += "\(convertedHTML)\n\n" } diff --git a/Mac/MainWindow/Timeline/Cell/TimelineCellLayout.swift b/Mac/MainWindow/Timeline/Cell/TimelineCellLayout.swift index e925eda03..555916e5d 100644 --- a/Mac/MainWindow/Timeline/Cell/TimelineCellLayout.swift +++ b/Mac/MainWindow/Timeline/Cell/TimelineCellLayout.swift @@ -42,8 +42,7 @@ import RSCore if height > 0.1 { self.height = height - } - else { + } else { self.height = [feedNameRect, dateRect, titleRect, summaryRect, textRect, unreadIndicatorRect, iconImageRect].maxY() + paddingBottom } } @@ -62,8 +61,7 @@ import RSCore var lastTextRect = titleRect if numberOfLinesForTitle == 0 { lastTextRect = textRect - } - else if numberOfLinesForTitle < appearance.titleNumberOfLines { + } else if numberOfLinesForTitle < appearance.titleNumberOfLines { if summaryRect.height > 0.1 { lastTextRect = summaryRect } diff --git a/Mac/MainWindow/Timeline/Cell/TimelineTableCellView.swift b/Mac/MainWindow/Timeline/Cell/TimelineTableCellView.swift index 24111455c..cbafeda5b 100644 --- a/Mac/MainWindow/Timeline/Cell/TimelineTableCellView.swift +++ b/Mac/MainWindow/Timeline/Cell/TimelineTableCellView.swift @@ -149,8 +149,7 @@ private extension TimelineTableCellView { if Int(floor(rect.height)) == 0 || Int(floor(rect.width)) == 0 { hideView(textField) - } - else { + } else { showView(textField) textField.setFrame(ifNotEqualTo: rect) } diff --git a/Mac/MainWindow/Timeline/TimelineContainerViewController.swift b/Mac/MainWindow/Timeline/TimelineContainerViewController.swift index 592189eb1..054d140a7 100644 --- a/Mac/MainWindow/Timeline/TimelineContainerViewController.swift +++ b/Mac/MainWindow/Timeline/TimelineContainerViewController.swift @@ -183,8 +183,7 @@ private extension TimelineContainerViewController { func mode(for timelineViewController: TimelineViewController) -> TimelineSourceMode { if timelineViewController === regularTimelineViewController { return .regular - } - else if timelineViewController === searchTimelineViewController { + } else if timelineViewController === searchTimelineViewController { return .search } assertionFailure("Expected timelineViewController to match either regular or search timelineViewController, but it doesn’t.") diff --git a/Mac/MainWindow/Timeline/TimelineViewController.swift b/Mac/MainWindow/Timeline/TimelineViewController.swift index 5d2d0d0b0..a75f7dfbd 100644 --- a/Mac/MainWindow/Timeline/TimelineViewController.swift +++ b/Mac/MainWindow/Timeline/TimelineViewController.swift @@ -405,8 +405,7 @@ final class TimelineViewController: NSViewController, UndoableCommandRunner, Unr if markAsRead { markSelectedArticlesAsRead(sender) - } - else { + } else { markSelectedArticlesAsUnread(sender) } } @@ -563,8 +562,7 @@ final class TimelineViewController: NSViewController, UndoableCommandRunner, Unr for article in selectedArticles { if cutoffDate == nil { cutoffDate = article.logicalDatePublished - } - else if cutoffDate! > article.logicalDatePublished { + } else if cutoffDate! > article.logicalDatePublished { cutoffDate = article.logicalDatePublished } } @@ -913,8 +911,7 @@ extension TimelineViewController: NSTableViewDelegate { cell.cellAppearance = showIcons ? cellAppearanceWithIcon : cellAppearance if let article = articles.articleAtRow(row) { configureTimelineCell(cell, article: article) - } - else { + } else { makeTimelineCellEmpty(cell) } } @@ -1316,8 +1313,7 @@ private extension TimelineViewController { return true } } - } - else if let folder = representedObject as? Folder { + } else if let folder = representedObject as? Folder { for oneFeed in feeds { if folder.hasFeed(with: oneFeed.feedID) || folder.hasFeed(withURL: oneFeed.url) { return true diff --git a/Mac/Preferences/Accounts/AddAccountHelpView.swift b/Mac/Preferences/Accounts/AddAccountHelpView.swift index eee6f2224..efd039c43 100644 --- a/Mac/Preferences/Accounts/AddAccountHelpView.swift +++ b/Mac/Preferences/Accounts/AddAccountHelpView.swift @@ -25,8 +25,7 @@ struct AddAccountHelpView: View { ForEach(accountTypes, id: \.self) { accountType in if accountType == .cloudKit && hasiCloudAccount { EmptyView() - } - else if !(AppDefaults.shared.isDeveloperBuild && accountType.isDeveloperRestricted) { + } else if !(AppDefaults.shared.isDeveloperBuild && accountType.isDeveloperRestricted) { Button(action: { delegate?.presentSheetForAccount(accountType) }, label: { diff --git a/Mac/Preferences/Advanced/AdvancedPreferencesViewController.swift b/Mac/Preferences/Advanced/AdvancedPreferencesViewController.swift index 462a43d73..45e2b1a6a 100644 --- a/Mac/Preferences/Advanced/AdvancedPreferencesViewController.swift +++ b/Mac/Preferences/Advanced/AdvancedPreferencesViewController.swift @@ -57,8 +57,7 @@ private extension AdvancedPreferencesViewController { func updateUI() { if wantsTestBuilds { testBuildsButton.state = .on - } - else { + } else { releaseBuildsButton.state = .on } } diff --git a/Mac/Preferences/PreferencesWindowController.swift b/Mac/Preferences/PreferencesWindowController.swift index f943b55ce..19081bcf7 100644 --- a/Mac/Preferences/PreferencesWindowController.swift +++ b/Mac/Preferences/PreferencesWindowController.swift @@ -140,8 +140,7 @@ private extension PreferencesWindowController { if let currentView = currentView { window!.contentView?.replaceSubview(currentView, with: newViewController.view) - } - else { + } else { window!.contentView?.addSubview(newViewController.view) } diff --git a/Mac/SafariExtension/SafariExtensionHandler.swift b/Mac/SafariExtension/SafariExtensionHandler.swift index 4f94d8108..f2c17a056 100644 --- a/Mac/SafariExtension/SafariExtensionHandler.swift +++ b/Mac/SafariExtension/SafariExtensionHandler.swift @@ -61,8 +61,7 @@ final class SafariExtensionHandler: SFSafariExtensionHandler { NSWorkspace.shared.open(feedURL) } } - } - else if (messageName == "pong") { + } else if (messageName == "pong") { if let validationIDString = userInfo?["validationID"] as? String { // Should we validate the button? let shouldValidate = userInfo?["shouldValidate"] as? Bool ?? false diff --git a/Modules/Articles/Sources/Articles/Article.swift b/Modules/Articles/Sources/Articles/Article.swift index d08c1d1d4..ac10958e9 100644 --- a/Modules/Articles/Sources/Articles/Article.swift +++ b/Modules/Articles/Sources/Articles/Article.swift @@ -47,8 +47,7 @@ public final class Article: Hashable, Sendable { if let articleID = articleID { self.articleID = articleID - } - else { + } else { self.articleID = Article.calculatedArticleID(feedID: feedID, uniqueID: uniqueID) } } diff --git a/Modules/Articles/Sources/Articles/Author.swift b/Modules/Articles/Sources/Articles/Author.swift index 7736f3f56..630ffda63 100644 --- a/Modules/Articles/Sources/Articles/Author.swift +++ b/Modules/Articles/Sources/Articles/Author.swift @@ -26,8 +26,7 @@ public struct Author: Codable, Hashable, Sendable { if let authorID = authorID { self.authorID = authorID - } - else { + } else { var s = name ?? "" s += url ?? "" s += avatarURL ?? "" @@ -46,8 +45,7 @@ public struct Author: Codable, Hashable, Sendable { do { let authors = try decoder.decode([Author].self, from: data) return Set(authors) - } - catch { + } catch { assertionFailure("JSON representation of Author array could not be decoded: \(jsonString) error: \(error)") } return nil @@ -75,8 +73,7 @@ extension Set where Element == Author { do { let jsonData = try encoder.encode(Array(self)) return String(data: jsonData, encoding: .utf8) - } - catch { + } catch { assertionFailure("JSON representation of Author array could not be encoded: \(self) error: \(error)") } return nil diff --git a/Modules/FeedFinder/Sources/FeedFinder/HTMLFeedFinder.swift b/Modules/FeedFinder/Sources/FeedFinder/HTMLFeedFinder.swift index 815d53f9f..f2747d2ca 100644 --- a/Modules/FeedFinder/Sources/FeedFinder/HTMLFeedFinder.swift +++ b/Modules/FeedFinder/Sources/FeedFinder/HTMLFeedFinder.swift @@ -50,8 +50,7 @@ private extension HTMLFeedFinder { if let existingFeedSpecifier = feedSpecifiersDictionary[feedSpecifier.urlString] { let mergedFeedSpecifier = existingFeedSpecifier.feedSpecifierByMerging(feedSpecifier) feedSpecifiersDictionary[feedSpecifier.urlString] = mergedFeedSpecifier - } - else { + } else { feedSpecifiersDictionary[feedSpecifier.urlString] = feedSpecifier } } diff --git a/Modules/RSCore/Sources/RSCore/AppKit/MultilineTextFieldSizer.swift b/Modules/RSCore/Sources/RSCore/AppKit/MultilineTextFieldSizer.swift index 2ffec8b92..5f93ec55d 100644 --- a/Modules/RSCore/Sources/RSCore/AppKit/MultilineTextFieldSizer.swift +++ b/Modules/RSCore/Sources/RSCore/AppKit/MultilineTextFieldSizer.swift @@ -227,8 +227,7 @@ private extension MultilineTextFieldSizer { if oneWidth < width && (oneWidth > smallNeighbor.width || smallNeighbor.width == 0) { smallNeighbor = (oneWidth, oneHeight) - } - else if oneWidth > width && (oneWidth < largeNeighbor.width || largeNeighbor.width == 0) { + } else if oneWidth > width && (oneWidth < largeNeighbor.width || largeNeighbor.width == 0) { largeNeighbor = (oneWidth, oneHeight) } diff --git a/Modules/RSCore/Sources/RSCore/AppKit/NSOutlineView+RSCore.swift b/Modules/RSCore/Sources/RSCore/AppKit/NSOutlineView+RSCore.swift index 067427f6e..e8348e1b1 100644 --- a/Modules/RSCore/Sources/RSCore/AppKit/NSOutlineView+RSCore.swift +++ b/Modules/RSCore/Sources/RSCore/AppKit/NSOutlineView+RSCore.swift @@ -69,8 +69,7 @@ public extension NSOutlineView { selectRowAndScrollToVisible(row) return } - } - else { + } else { return // if there are no more items, we’re out of rows } } diff --git a/Modules/RSCore/Sources/RSCore/AppKit/NSResponder+RSCore.swift b/Modules/RSCore/Sources/RSCore/AppKit/NSResponder+RSCore.swift index dbf7f4f84..e63c3ba90 100644 --- a/Modules/RSCore/Sources/RSCore/AppKit/NSResponder+RSCore.swift +++ b/Modules/RSCore/Sources/RSCore/AppKit/NSResponder+RSCore.swift @@ -19,8 +19,7 @@ public extension NSResponder { } if let _ = nomad.nextResponder { nomad = nomad.nextResponder! - } - else { + } else { break } } diff --git a/Modules/RSCore/Sources/RSCore/AppKit/UserApp.swift b/Modules/RSCore/Sources/RSCore/AppKit/UserApp.swift index 7246a42d1..363fda885 100644 --- a/Modules/RSCore/Sources/RSCore/AppKit/UserApp.swift +++ b/Modules/RSCore/Sources/RSCore/AppKit/UserApp.swift @@ -44,8 +44,7 @@ public final class UserApp { if app == runningApplication { break } - } - else { + } else { if !app.isTerminated { runningApplication = app break @@ -58,8 +57,7 @@ public final class UserApp { icon = runningApplication.icon if let bundleURL = runningApplication.bundleURL { path = bundleURL.path - } - else { + } else { path = NSWorkspace.shared.urlForApplication(withBundleIdentifier: bundleID)?.path } if icon == nil, let path = path { @@ -74,8 +72,7 @@ public final class UserApp { icon = NSWorkspace.shared.icon(forFile: path) } existsOnDisk = true - } - else { + } else { existsOnDisk = false icon = nil } diff --git a/Modules/RSCore/Sources/RSCore/BinaryDiskCache.swift b/Modules/RSCore/Sources/RSCore/BinaryDiskCache.swift index 654d80f6c..723622ac8 100644 --- a/Modules/RSCore/Sources/RSCore/BinaryDiskCache.swift +++ b/Modules/RSCore/Sources/RSCore/BinaryDiskCache.swift @@ -53,8 +53,7 @@ nonisolated public final class BinaryDiskCache: Sendable { do { try _setData(data, forKey: key) } catch {} - } - else { + } else { do { try _deleteData(forKey: key) } catch {} diff --git a/Modules/RSDatabase/Sources/RSDatabase/Related Objects/DatabaseLookupTable.swift b/Modules/RSDatabase/Sources/RSDatabase/Related Objects/DatabaseLookupTable.swift index 3fb244d53..4a189ca8a 100644 --- a/Modules/RSDatabase/Sources/RSDatabase/Related Objects/DatabaseLookupTable.swift +++ b/Modules/RSDatabase/Sources/RSDatabase/Related Objects/DatabaseLookupTable.swift @@ -70,8 +70,7 @@ public final class DatabaseLookupTable: Sendable { for object in objects { if let relatedObjects = object.relatedObjectsWithName(relationshipName), !relatedObjects.isEmpty { objectsWithRelationships += [object] - } - else { + } else { objectsWithNoRelationships += [object] } } diff --git a/Modules/RSDatabase/Sources/RSDatabase/Related Objects/DatabaseRelatedObjectsTable.swift b/Modules/RSDatabase/Sources/RSDatabase/Related Objects/DatabaseRelatedObjectsTable.swift index dfcd40daf..ec8cce4d3 100644 --- a/Modules/RSDatabase/Sources/RSDatabase/Related Objects/DatabaseRelatedObjectsTable.swift +++ b/Modules/RSDatabase/Sources/RSDatabase/Related Objects/DatabaseRelatedObjectsTable.swift @@ -39,8 +39,7 @@ public extension DatabaseRelatedObjectsTable { for databaseID in databaseIDs { if let cachedObject = cache[databaseID] { cachedObjects += [cachedObject] - } - else { + } else { databaseIDsToFetch.insert(databaseID) } } diff --git a/Modules/RSDatabase/Sources/RSDatabase/Related Objects/RelatedObjectIDsMap.swift b/Modules/RSDatabase/Sources/RSDatabase/Related Objects/RelatedObjectIDsMap.swift index 318f8f339..43e1a64f6 100644 --- a/Modules/RSDatabase/Sources/RSDatabase/Related Objects/RelatedObjectIDsMap.swift +++ b/Modules/RSDatabase/Sources/RSDatabase/Related Objects/RelatedObjectIDsMap.swift @@ -27,8 +27,7 @@ struct RelatedObjectIDsMap: Sendable { let relatedObjectID: String = lookupValue.relatedObjectID if d[objectID] == nil { d[objectID] = Set([relatedObjectID]) - } - else { + } else { d[objectID]!.insert(relatedObjectID) } } diff --git a/Modules/RSParser/Sources/Swift/Feeds/FeedParser.swift b/Modules/RSParser/Sources/Swift/Feeds/FeedParser.swift index 61fb60821..102b91f73 100644 --- a/Modules/RSParser/Sources/Swift/Feeds/FeedParser.swift +++ b/Modules/RSParser/Sources/Swift/Feeds/FeedParser.swift @@ -68,8 +68,7 @@ public struct FeedParser { case .unknown, .notAFeed: return nil } - } - catch { throw error } + } catch { throw error } } public static func parse(_ parserData: ParserData) async throws -> ParsedFeed? { @@ -77,8 +76,7 @@ public struct FeedParser { parse(parserData) { parsedFeed, error in if let error { continuation.resume(throwing: error) - } - else { + } else { continuation.resume(returning: parsedFeed) } } diff --git a/Modules/RSParser/Sources/Swift/Feeds/JSON/RSSInJSONParser.swift b/Modules/RSParser/Sources/Swift/Feeds/JSON/RSSInJSONParser.swift index 1ddc9519a..8d0b01953 100644 --- a/Modules/RSParser/Sources/Swift/Feeds/JSON/RSSInJSONParser.swift +++ b/Modules/RSParser/Sources/Swift/Feeds/JSON/RSSInJSONParser.swift @@ -54,8 +54,7 @@ public struct RSSInJSONParser { return ParsedFeed(type: .rssInJSON, title: title, homePageURL: homePageURL, feedURL: feedURL, language: feedLanguage, feedDescription: feedDescription, nextURL: nil, iconURL: nil, faviconURL: nil, authors: nil, expired: false, hubs: nil, items: items) - } - catch { throw error } + } catch { throw error } } } @@ -149,8 +148,7 @@ private extension RSSInJSONParser { return Set([oneTag]) } return nil - } - else if let categoryArray = itemDictionary["category"] as? JSONArray { + } else if let categoryArray = itemDictionary["category"] as? JSONArray { return Set(categoryArray.compactMap{ $0["#value"] as? String }) } return nil diff --git a/Modules/RSParser/Sources/Swift/Feeds/ParsedItem.swift b/Modules/RSParser/Sources/Swift/Feeds/ParsedItem.swift index bd314dfd1..96b879d91 100644 --- a/Modules/RSParser/Sources/Swift/Feeds/ParsedItem.swift +++ b/Modules/RSParser/Sources/Swift/Feeds/ParsedItem.swift @@ -65,8 +65,7 @@ public struct ParsedItem: Hashable, Sendable { public func hash(into hasher: inout Hasher) { if let syncServiceID = syncServiceID { hasher.combine(syncServiceID) - } - else { + } else { hasher.combine(uniqueID) hasher.combine(feedURL) } diff --git a/Modules/RSParser/Tests/RSParserTests/AtomParserTests.swift b/Modules/RSParser/Tests/RSParserTests/AtomParserTests.swift index a3ed31ad5..b98a7ae05 100644 --- a/Modules/RSParser/Tests/RSParserTests/AtomParserTests.swift +++ b/Modules/RSParser/Tests/RSParserTests/AtomParserTests.swift @@ -134,8 +134,7 @@ final class AtomParserTests: XCTestCase { let author = article.authors!.first! if author.name == "Daring Fireball Department of Commerce" { XCTAssertNil(author.url) - } - else { + } else { XCTAssertEqual(author.name, "John Gruber") XCTAssertEqual(author.url, "http://daringfireball.net/") } diff --git a/Modules/RSWeb/Sources/RSWeb/URL+RSWeb.swift b/Modules/RSWeb/Sources/RSWeb/URL+RSWeb.swift index 1668ea3b4..b69abe1a6 100755 --- a/Modules/RSWeb/Sources/RSWeb/URL+RSWeb.swift +++ b/Modules/RSWeb/Sources/RSWeb/URL+RSWeb.swift @@ -34,8 +34,7 @@ public extension URL { if isHTTPSURL() { return absoluteString.stringByRemovingCaseInsensitivePrefix(URLConstants.prefixHTTPS) - } - else if isHTTPURL() { + } else if isHTTPURL() { return absoluteString.stringByRemovingCaseInsensitivePrefix(URLConstants.prefixHTTP) } diff --git a/Modules/RSWeb/Sources/RSWeb/WebServices/TransportJSON.swift b/Modules/RSWeb/Sources/RSWeb/WebServices/TransportJSON.swift index 043867417..3ba49e2a6 100644 --- a/Modules/RSWeb/Sources/RSWeb/WebServices/TransportJSON.swift +++ b/Modules/RSWeb/Sources/RSWeb/WebServices/TransportJSON.swift @@ -42,15 +42,13 @@ nonisolated extension Transport { DispatchQueue.main.async { completion(.success((response, decoded))) } - } - catch { + } catch { DispatchQueue.main.async { completion(.failure(error)) } } } - } - else { + } else { completion(.success((response, nil))) } diff --git a/iOS/MainTimeline/Cells/MainTimelineCellData.swift b/iOS/MainTimeline/Cells/MainTimelineCellData.swift index faaddf7f7..aef136ef2 100644 --- a/iOS/MainTimeline/Cells/MainTimelineCellData.swift +++ b/iOS/MainTimeline/Cells/MainTimelineCellData.swift @@ -43,8 +43,7 @@ import Articles if let feedName = feedName { self.feedName = ArticleStringFormatter.truncatedFeedName(feedName) - } - else { + } else { self.feedName = "" } diff --git a/iOS/SceneCoordinator.swift b/iOS/SceneCoordinator.swift index 8280f20c3..3d7c8f5cd 100644 --- a/iOS/SceneCoordinator.swift +++ b/iOS/SceneCoordinator.swift @@ -646,8 +646,7 @@ struct FeedNode: Hashable, Sendable { } } } - } - else { + } else { self.mainFeedCollectionViewController?.navigationItem.subtitle = "" // If unread count > 0, add unread string to timeline if let _ = timelineFeed, timelineUnreadCount > 0 { @@ -1385,8 +1384,7 @@ struct FeedNode: Hashable, Sendable { func showInAppBrowser() { if currentArticle != nil { articleViewController?.openInAppBrowser() - } - else { + } else { mainFeedCollectionViewController.openInAppBrowser() } }