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

@ -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
}

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
}