From 4a1df033754c377c284580528908d683f7f894ce Mon Sep 17 00:00:00 2001 From: Brent Simmons Date: Fri, 24 Jan 2025 23:02:17 -0800 Subject: [PATCH] Fix lint issues. --- Mac/Scriptability/Folder+Scriptability.swift | 2 +- Mac/Scriptability/WebFeed+Scriptability.swift | 6 +++--- .../Sources/Account/AccountManager.swift | 2 +- .../Account/Feedbin/FeedbinSubscription.swift | 4 ++-- .../ReaderAPI/ReaderAPIAccountDelegate.swift | 4 +--- .../Account/ReaderAPI/ReaderAPICaller.swift | 4 +--- .../Account/ReaderAPI/ReaderAPIEntry.swift | 18 +++++++++--------- .../ReaderAPI/ReaderAPISubscription.swift | 8 ++++---- .../Account/ReaderAPI/ReaderAPITag.swift | 4 ++-- .../ReaderAPI/ReaderAPIUnreadEntry.swift | 4 ++-- .../Tests/ParserTests/Resources/curt.json | 2 +- .../RSCore/AppKit/URLPasteboardWriter.swift | 2 +- Modules/RSTree/Sources/RSTree/Node.swift | 8 ++++---- .../RSWeb/Sources/RSWeb/MacWebBrowser.swift | 8 ++++---- Shared/Extensions/Node-Extensions.swift | 4 ++-- iOS/Article/FindInArticleActivity.swift | 2 +- iOS/Article/OpenInSafariActivity.swift | 2 +- 17 files changed, 40 insertions(+), 44 deletions(-) diff --git a/Mac/Scriptability/Folder+Scriptability.swift b/Mac/Scriptability/Folder+Scriptability.swift index e60b45182..648631437 100644 --- a/Mac/Scriptability/Folder+Scriptability.swift +++ b/Mac/Scriptability/Folder+Scriptability.swift @@ -65,7 +65,7 @@ class ScriptableFolder: NSObject, UniqueIdScriptingObject, ScriptingObjectContai or tell account X to make new folder at end with properties {name:"new folder name"} */ - class func handleCreateElement(command: NSCreateCommand) -> Any? { + static func handleCreateElement(command: NSCreateCommand) -> Any? { guard command.isCreateCommand(forClass: "fold") else { return nil } let name = command.property(forKey: "name") as? String ?? "" diff --git a/Mac/Scriptability/WebFeed+Scriptability.swift b/Mac/Scriptability/WebFeed+Scriptability.swift index 30e3e88c9..7795f25cf 100644 --- a/Mac/Scriptability/WebFeed+Scriptability.swift +++ b/Mac/Scriptability/WebFeed+Scriptability.swift @@ -59,7 +59,7 @@ class ScriptableFeed: NSObject, UniqueIdScriptingObject, ScriptingObjectContaine // MARK: --- handle NSCreateCommand --- - class func urlForNewFeed(arguments: [String: Any]) -> String? { + static func urlForNewFeed(arguments: [String: Any]) -> String? { var url: String? if let withDataParam = arguments["ObjectData"] { if let objectDataDescriptor = withDataParam as? NSAppleEventDescriptor { @@ -71,7 +71,7 @@ class ScriptableFeed: NSObject, UniqueIdScriptingObject, ScriptingObjectContaine return url } - class func scriptableFeed(_ feed: Feed, account: Account, folder: Folder?) -> ScriptableFeed { + static func scriptableFeed(_ feed: Feed, account: Account, folder: Folder?) -> ScriptableFeed { let scriptableAccount = ScriptableAccount(account) if let folder = folder { let scriptableFolder = ScriptableFolder(folder, container: scriptableAccount) @@ -81,7 +81,7 @@ class ScriptableFeed: NSObject, UniqueIdScriptingObject, ScriptingObjectContaine } } - class func handleCreateElement(command: NSCreateCommand) -> Any? { + static func handleCreateElement(command: NSCreateCommand) -> Any? { guard command.isCreateCommand(forClass: "Feed") else { return nil } guard let arguments = command.arguments else {return nil} let titleFromArgs = command.property(forKey: "name") as? String diff --git a/Modules/Account/Sources/Account/AccountManager.swift b/Modules/Account/Sources/Account/AccountManager.swift index c66005cfe..bbfe49401 100644 --- a/Modules/Account/Sources/Account/AccountManager.swift +++ b/Modules/Account/Sources/Account/AccountManager.swift @@ -327,7 +327,7 @@ public final class AccountManager: UnreadCountProvider { public func anyAccountHasFeedWithURL(_ urlString: String) -> Bool { for account in activeAccounts { - if let _ = account.existingFeed(withURL: urlString) { + if account.existingFeed(withURL: urlString) != nil { return true } } diff --git a/Modules/Account/Sources/Account/Feedbin/FeedbinSubscription.swift b/Modules/Account/Sources/Account/Feedbin/FeedbinSubscription.swift index c7ee76b65..6a4e88ae5 100644 --- a/Modules/Account/Sources/Account/Feedbin/FeedbinSubscription.swift +++ b/Modules/Account/Sources/Account/Feedbin/FeedbinSubscription.swift @@ -42,8 +42,8 @@ struct FeedbinSubscriptionJSONFeed: Codable { let favicon: String? let icon: String? enum CodingKeys: String, CodingKey { - case favicon = "favicon" - case icon = "icon" + case favicon + case icon } } diff --git a/Modules/Account/Sources/Account/ReaderAPI/ReaderAPIAccountDelegate.swift b/Modules/Account/Sources/Account/ReaderAPI/ReaderAPIAccountDelegate.swift index a63ed5437..13d7d375e 100644 --- a/Modules/Account/Sources/Account/ReaderAPI/ReaderAPIAccountDelegate.swift +++ b/Modules/Account/Sources/Account/ReaderAPI/ReaderAPIAccountDelegate.swift @@ -53,9 +53,7 @@ final class ReaderAPIAccountDelegate: AccountDelegate { } var server: String? { - get { - return caller.server - } + caller.server } var isOPMLImportInProgress = false diff --git a/Modules/Account/Sources/Account/ReaderAPI/ReaderAPICaller.swift b/Modules/Account/Sources/Account/ReaderAPI/ReaderAPICaller.swift index 99fdc9203..1c2b09dae 100644 --- a/Modules/Account/Sources/Account/ReaderAPI/ReaderAPICaller.swift +++ b/Modules/Account/Sources/Account/ReaderAPI/ReaderAPICaller.swift @@ -58,9 +58,7 @@ final class ReaderAPICaller: NSObject { var credentials: Credentials? var server: String? { - get { - return apiBaseURL?.host - } + return apiBaseURL?.host } private var apiBaseURL: URL? { diff --git a/Modules/Account/Sources/Account/ReaderAPI/ReaderAPIEntry.swift b/Modules/Account/Sources/Account/ReaderAPI/ReaderAPIEntry.swift index e2111863f..4534e3469 100644 --- a/Modules/Account/Sources/Account/ReaderAPI/ReaderAPIEntry.swift +++ b/Modules/Account/Sources/Account/ReaderAPI/ReaderAPIEntry.swift @@ -63,15 +63,15 @@ struct ReaderAPIEntry: Codable { enum CodingKeys: String, CodingKey { case articleID = "id" - case title = "title" - case author = "author" - case summary = "summary" + case title + case author + case summary case alternates = "alternate" - case categories = "categories" + case categories case publishedTimestamp = "published" case crawledTimestamp = "crawlTimeMsec" - case origin = "origin" - case timestampUsec = "timestampUsec" + case origin + case timestampUsec } func parseDatePublished() -> Date? { @@ -107,7 +107,7 @@ struct ReaderAPIArticleSummary: Codable { let content: String? enum CodingKeys: String, CodingKey { - case content = "content" + case content } } @@ -124,7 +124,7 @@ struct ReaderAPIEntryOrigin: Codable { let title: String? enum CodingKeys: String, CodingKey { - case streamId = "streamId" - case title = "title" + case streamId + case title } } diff --git a/Modules/Account/Sources/Account/ReaderAPI/ReaderAPISubscription.swift b/Modules/Account/Sources/Account/ReaderAPI/ReaderAPISubscription.swift index ece421c3f..99410d732 100644 --- a/Modules/Account/Sources/Account/ReaderAPI/ReaderAPISubscription.swift +++ b/Modules/Account/Sources/Account/ReaderAPI/ReaderAPISubscription.swift @@ -25,9 +25,9 @@ struct ReaderAPIQuickAddResult: Codable { let streamId: String? enum CodingKeys: String, CodingKey { - case numResults = "numResults" - case error = "error" - case streamId = "streamId" + case numResults + case error + case streamId } } @@ -35,7 +35,7 @@ struct ReaderAPISubscriptionContainer: Codable { let subscriptions: [ReaderAPISubscription] enum CodingKeys: String, CodingKey { - case subscriptions = "subscriptions" + case subscriptions } } diff --git a/Modules/Account/Sources/Account/ReaderAPI/ReaderAPITag.swift b/Modules/Account/Sources/Account/ReaderAPI/ReaderAPITag.swift index 345829a0e..6e1721b43 100644 --- a/Modules/Account/Sources/Account/ReaderAPI/ReaderAPITag.swift +++ b/Modules/Account/Sources/Account/ReaderAPI/ReaderAPITag.swift @@ -12,7 +12,7 @@ struct ReaderAPITagContainer: Codable { let tags: [ReaderAPITag] enum CodingKeys: String, CodingKey { - case tags = "tags" + case tags } } @@ -23,7 +23,7 @@ struct ReaderAPITag: Codable { enum CodingKeys: String, CodingKey { case tagID = "id" - case type = "type" + case type } var folderName: String? { diff --git a/Modules/Account/Sources/Account/ReaderAPI/ReaderAPIUnreadEntry.swift b/Modules/Account/Sources/Account/ReaderAPI/ReaderAPIUnreadEntry.swift index a80597adf..26d383e87 100644 --- a/Modules/Account/Sources/Account/ReaderAPI/ReaderAPIUnreadEntry.swift +++ b/Modules/Account/Sources/Account/ReaderAPI/ReaderAPIUnreadEntry.swift @@ -13,8 +13,8 @@ struct ReaderAPIReferenceWrapper: Codable { let continuation: String? enum CodingKeys: String, CodingKey { - case itemRefs = "itemRefs" - case continuation = "continuation" + case itemRefs + case continuation } } diff --git a/Modules/Parser/Tests/ParserTests/Resources/curt.json b/Modules/Parser/Tests/ParserTests/Resources/curt.json index 44a0686a4..a3ba367ac 100644 --- a/Modules/Parser/Tests/ParserTests/Resources/curt.json +++ b/Modules/Parser/Tests/ParserTests/Resources/curt.json @@ -1 +1 @@ -{"icon":"http:\/\/curtclifton.net\/style\/feedicon.png","user_comment":"This feed allows you to read the posts from this site in any feed reader that supports the JSON Feed format. To add this feed to your reader, copy the following URL — http:\/\/curtclifton.net\/feed.json — and add it your reader.","favicon":"http:\/\/curtclifton.net\/style\/touch-icon.png","description":"Full-text posts, generally related to software development on Apple’s platforms. Programming language geekery.","version":"https:\/\/jsonfeed.org\/version\/1","title":"curtclifton.net","items":[{"date_published":"2018-01-06T08:00","title":"Twitter Quitter","id":"twitter-quitter","content_html":"

I’ve decided to close my Twitter account. William Van Hecke makes a convincing case<\/a> for its diminishing utility, and it’s clear that Jack<\/a> is more concerned with eyeballs than standards<\/a>.<\/p>\n\n

I stopped regularly reading my timeline months ago. The few times I have dipped in, I’ve ended up angry or depressed. Despite occasional bright spots, there is always someone sharing the angst of the day. I read the news. I don’t need Twitter to make me more anxious. As such, I’ve only been using Twitter for cross posting from my micro.blog account<\/a> and responding to mentions. Slack<\/a> meets my social chat needs without the screaming-into-the-void that Twitter has become.<\/p>\n\n

After some reflection, I’ve concluded that even posting to Twitter is just providing content to a platform for hate and anger. I can’t fix that problem, but I can stop contributing to the platform. And so I will.<\/p>\n\n

I’m taking my Twitter account private. I’ll stop reading and (after this) posting to it. If you want to get in touch, please email<\/a>, iMessage, or drop a mention <\/span>@<\/span>curt<\/span><\/code> on micro.blog<\/a>. I’d also be happy for an invite to your Slack group or a friend request on Facebook<\/a>.<\/em> (While Facebook is also an addiction-exploiting attention hole, it provides much more control to users. The positives there outweigh the negatives.)<\/p>\n\n

Be well. Find the good in the world. Peace.<\/p>\n","url":"http:\/\/www.curtclifton.net\/twitter-quitter"},{"date_published":"2017-12-15T08:00","title":"Next Actions","id":"next-actions","content_html":"

After six and a half wonderful years, today is my last with the Omni Group. It’s been the joy and privilege of a lifetime to work with the great people at Omni. Care for others permeates the culture at Omni, from interpersonal interactions, to software design, to our amazing Support Humans. It’s been especially rewarding to contribute to OmniFocus<\/a>, an app that’s been invaluable to me personally and that helps many others achieve their goals.<\/p>\n\n

While it’s difficult to say goodbye to all that, I have an opportunity to join a small fruit company in Cupertino working on iPad software for education. The role combines several of my passions: teaching, learning, mentoring, and building elegant software. I’m looking forward to joining my new team in January and making great things together.<\/p>\n\n

I’ll miss the amazing Xcoders<\/a> community, but hope to make it back occasionally. And, of course, I’ll see you all when you come to San Jose for WWDC and related festivities. <\/p>\n\n

It will be great to be able spend more time with friends in the Bay Area. The next few weeks will be a whirlwind with the holidays and moving, but if you’re in the area hit me up<\/a> in the new year and let’s get together.<\/p>\n","url":"http:\/\/www.curtclifton.net\/next-actions"},{"date_published":"2017-10-27T07:00","title":"These are a Few of My Stateful Machines","id":"these-are-a-few-of-my-stateful-machines","content_html":"

I’m excited to be presenting at the inaugural Swift by Northwest<\/a> conference today. My talk is on state machines and how easy they are to implement in Swift.<\/p>\n\n