Fix lint issues.

This commit is contained in:
Brent Simmons 2025-01-24 22:13:01 -08:00
parent 9bf4fea962
commit f1640d8d09
7 changed files with 49 additions and 47 deletions

View File

@ -23,6 +23,8 @@ disabled_rules:
- generic_type_name
- function_body_length
- type_body_length
- function_parameter_count
- line_length
excluded:
- Modules/Secrets/Sources/Secrets/SecretKey.swift

View File

@ -8,7 +8,7 @@
import AppKit
protocol RenameWindowControllerDelegate {
protocol RenameWindowControllerDelegate: AnyObject {
func renameWindowController(_ windowController: RenameWindowController, didRenameObject: Any, withNewName: String)
}
@ -21,7 +21,7 @@ final class RenameWindowController: NSWindowController {
private var originalTitle: String?
private var representedObject: Any?
private var delegate: RenameWindowControllerDelegate?
private weak var delegate: RenameWindowControllerDelegate?
convenience init(originalTitle: String, representedObject: Any, delegate: RenameWindowControllerDelegate) {

View File

@ -215,7 +215,7 @@ private extension SidebarViewController {
menu.addItem(NSMenuItem.separator())
}
if let homePageURL = feed.homePageURL, let _ = URL(string: homePageURL) {
if let homePageURL = feed.homePageURL, URL(string: homePageURL) != nil {
let item = menuItem(NSLocalizedString("Open Home Page", comment: "Command"), #selector(openHomePageFromContextualMenu(_:)), homePageURL)
menu.addItem(item)
menu.addItem(NSMenuItem.separator())

View File

@ -71,20 +71,20 @@ class ReaderAPIAccountViewController: UITableViewController {
private func setupFooter() {
switch accountType {
case .bazQux:
footerLabel.text = NSLocalizedString("Sign in to your BazQux account and sync your feeds across your devices. Your username and password will be encrypted and stored in Keychain.\n\nDont have a BazQux account?", comment: "BazQux")
signUpButton.setTitle(NSLocalizedString("Sign Up Here", comment: "BazQux SignUp"), for: .normal)
case .inoreader:
footerLabel.text = NSLocalizedString("Sign in to your InoReader account and sync your feeds across your devices. Your username and password will be encrypted and stored in Keychain.\n\nDont have an InoReader account?", comment: "InoReader")
signUpButton.setTitle(NSLocalizedString("Sign Up Here", comment: "InoReader SignUp"), for: .normal)
case .theOldReader:
footerLabel.text = NSLocalizedString("Sign in to your The Old Reader account and sync your feeds across your devices. Your username and password will be encrypted and stored in Keychain.\n\nDont have a The Old Reader account?", comment: "TOR")
signUpButton.setTitle(NSLocalizedString("Sign Up Here", comment: "TOR SignUp"), for: .normal)
case .freshRSS:
footerLabel.text = NSLocalizedString("Sign in to your FreshRSS instance and sync your feeds across your devices. Your username and password will be encrypted and stored in Keychain.\n\nDont have an FreshRSS instance?", comment: "FreshRSS")
signUpButton.setTitle(NSLocalizedString("Find Out More", comment: "FreshRSS SignUp"), for: .normal)
default:
return
case .bazQux:
footerLabel.text = NSLocalizedString("Sign in to your BazQux account and sync your feeds across your devices. Your username and password will be encrypted and stored in Keychain.\n\nDont have a BazQux account?", comment: "BazQux")
signUpButton.setTitle(NSLocalizedString("Sign Up Here", comment: "BazQux SignUp"), for: .normal)
case .inoreader:
footerLabel.text = NSLocalizedString("Sign in to your InoReader account and sync your feeds across your devices. Your username and password will be encrypted and stored in Keychain.\n\nDont have an InoReader account?", comment: "InoReader")
signUpButton.setTitle(NSLocalizedString("Sign Up Here", comment: "InoReader SignUp"), for: .normal)
case .theOldReader:
footerLabel.text = NSLocalizedString("Sign in to your The Old Reader account and sync your feeds across your devices. Your username and password will be encrypted and stored in Keychain.\n\nDont have a The Old Reader account?", comment: "TOR")
signUpButton.setTitle(NSLocalizedString("Sign Up Here", comment: "TOR SignUp"), for: .normal)
case .freshRSS:
footerLabel.text = NSLocalizedString("Sign in to your FreshRSS instance and sync your feeds across your devices. Your username and password will be encrypted and stored in Keychain.\n\nDont have an FreshRSS instance?", comment: "FreshRSS")
signUpButton.setTitle(NSLocalizedString("Find Out More", comment: "FreshRSS SignUp"), for: .normal)
default:
return
}
}
@ -209,16 +209,16 @@ class ReaderAPIAccountViewController: UITableViewController {
private func headerViewImage() -> UIImage? {
if let accountType = accountType {
switch accountType {
case .bazQux:
return AppAssets.accountBazQuxImage
case .inoreader:
return AppAssets.accountInoreaderImage
case .theOldReader:
return AppAssets.accountTheOldReaderImage
case .freshRSS:
return AppAssets.accountFreshRSSImage
default:
return nil
case .bazQux:
return AppAssets.accountBazQuxImage
case .inoreader:
return AppAssets.accountInoreaderImage
case .theOldReader:
return AppAssets.accountTheOldReaderImage
case .freshRSS:
return AppAssets.accountFreshRSSImage
default:
return nil
}
}
return nil
@ -231,7 +231,7 @@ class ReaderAPIAccountViewController: UITableViewController {
showError(NSLocalizedString("Username, password, and API URL are required.", comment: "Credentials Error"))
return false
}
guard let _ = URL(string: apiURLTextField.text!) else {
guard URL(string: apiURLTextField.text!) != nil else {
showError(NSLocalizedString("Invalid API URL.", comment: "Invalid API URL"))
return false
}
@ -247,16 +247,16 @@ class ReaderAPIAccountViewController: UITableViewController {
@IBAction func signUpWithProvider(_ sender: Any) {
var url: URL!
switch accountType {
case .bazQux:
url = URL(string: "https://bazqux.com")!
case .inoreader:
url = URL(string: "https://www.inoreader.com")!
case .theOldReader:
url = URL(string: "https://theoldreader.com")!
case .freshRSS:
url = URL(string: "https://freshrss.org")!
default:
return
case .bazQux:
url = URL(string: "https://bazqux.com")!
case .inoreader:
url = URL(string: "https://www.inoreader.com")!
case .theOldReader:
url = URL(string: "https://theoldreader.com")!
case .freshRSS:
url = URL(string: "https://freshrss.org")!
default:
return
}
let safari = SFSafariViewController(url: url)
safari.modalPresentationStyle = .currentContext

View File

@ -14,10 +14,12 @@ import SafariServices
class ArticleViewController: UIViewController {
typealias State = (extractedArticle: ExtractedArticle?,
isShowingExtractedArticle: Bool,
articleExtractorButtonState: ArticleExtractorButtonState,
windowScrollY: Int)
struct State {
let extractedArticle: ExtractedArticle?
let isShowingExtractedArticle: Bool
let articleExtractorButtonState: ArticleExtractorButtonState
let windowScrollY: Int
}
@IBOutlet private weak var nextUnreadBarButtonItem: UIBarButtonItem!
@IBOutlet private weak var prevArticleBarButtonItem: UIBarButtonItem!
@ -360,8 +362,7 @@ public extension Notification.Name {
extension ArticleViewController: SearchBarDelegate {
func searchBar(_ searchBar: ArticleSearchBar, textDidChange searchText: String) {
currentWebViewController?.searchText(searchText) {
found in
currentWebViewController?.searchText(searchText) { found in
searchBar.resultsCount = found.count
if let index = found.index {

View File

@ -835,8 +835,7 @@ extension WebViewController {
}
let encoded = json.base64EncodedString()
webView?.evaluateJavaScript("updateFind(\"\(encoded)\")") {
(result, error) in
webView?.evaluateJavaScript("updateFind(\"\(encoded)\")") { (result, error) in
guard error == nil,
let b64 = result as? String,
let rawData = Data(base64Encoded: b64),

View File

@ -43,7 +43,7 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
NotificationCenter.default.addObserver(self, selector: #selector(userDefaultsDidChange), name: UserDefaults.didChangeNotification, object: nil)
if let _ = connectionOptions.urlContexts.first?.url {
if connectionOptions.urlContexts.first?.url != nil {
self.scene(scene, openURLContexts: connectionOptions.urlContexts)
return
}