Fix lint issues.

This commit is contained in:
Brent Simmons 2025-01-24 22:31:37 -08:00
parent f1640d8d09
commit cc4914a7ef
17 changed files with 47 additions and 55 deletions

@ -3,11 +3,11 @@ identifier_name:
max_length: 50 max_length: 50
allowed_symbols: "_" allowed_symbols: "_"
line_length: # line_length:
warning: 200 # warning: 200
error: 300 # error: 300
ignores_comments: true # ignores_comments: true
ignores_urls: true # ignores_urls: true
large_tuple: large_tuple:
warning: 3 warning: 3

@ -30,17 +30,12 @@ final class BuiltinSmartFeedInspectorViewController: NSViewController, Inspector
var windowTitle: String = NSLocalizedString("Smart Feed Inspector", comment: "Smart Feed Inspector window title") var windowTitle: String = NSLocalizedString("Smart Feed Inspector", comment: "Smart Feed Inspector window title")
func canInspect(_ objects: [Any]) -> Bool { func canInspect(_ objects: [Any]) -> Bool {
singleSmartFeed(from: objects) != nil
guard let _ = singleSmartFeed(from: objects) else {
return false
}
return true
} }
// MARK: NSViewController // MARK: NSViewController
override func viewDidLoad() { override func viewDidLoad() {
updateUI() updateUI()
} }
} }
@ -57,7 +52,6 @@ private extension BuiltinSmartFeedInspectorViewController {
} }
func updateSmartFeed() { func updateSmartFeed() {
smartFeed = singleSmartFeed(from: objects) smartFeed = singleSmartFeed(from: objects)
} }

@ -21,7 +21,7 @@ typealias InspectorViewController = Inspector & NSViewController
final class InspectorWindowController: NSWindowController { final class InspectorWindowController: NSWindowController {
class var shouldOpenAtStartup: Bool { static var shouldOpenAtStartup: Bool {
return UserDefaults.standard.bool(forKey: DefaultsKey.windowIsOpen) return UserDefaults.standard.bool(forKey: DefaultsKey.windowIsOpen)
} }

@ -272,9 +272,13 @@ class MainWindowController: NSWindowController, NSUserInterfaceValidations {
guard let detailViewController = detailViewController else { guard let detailViewController = detailViewController else {
return return
} }
detailViewController.canScrollDown { (canScroll) in detailViewController.canScrollDown { canScroll in
NSCursor.setHiddenUntilMouseMoves(true) NSCursor.setHiddenUntilMouseMoves(true)
canScroll ? detailViewController.scrollPageDown(sender) : self.nextUnread(sender) if canScroll {
detailViewController.scrollPageDown(sender)
} else {
self.nextUnread(sender)
}
} }
} }

@ -302,10 +302,7 @@ protocol SidebarDelegate: AnyObject {
// MARK: - Navigation // MARK: - Navigation
func canGoToNextUnread(wrappingToTop wrapping: Bool = false) -> Bool { func canGoToNextUnread(wrappingToTop wrapping: Bool = false) -> Bool {
if let _ = nextSelectableRowWithUnreadArticle(wrappingToTop: wrapping) { nextSelectableRowWithUnreadArticle(wrappingToTop: wrapping) != nil
return true
}
return false
} }
func goToNextUnread(wrappingToTop wrapping: Bool = false) { func goToNextUnread(wrappingToTop wrapping: Bool = false) {

@ -38,7 +38,7 @@ extension Article: @retroactive PasteboardWriterOwner {
func writableTypes(for pasteboard: NSPasteboard) -> [NSPasteboard.PasteboardType] { func writableTypes(for pasteboard: NSPasteboard) -> [NSPasteboard.PasteboardType] {
var types = [ArticlePasteboardWriter.articleUTIType] var types = [ArticlePasteboardWriter.articleUTIType]
if let _ = article.preferredURL { if article.preferredURL != nil {
types += [.URL] types += [.URL]
} }
types += [.string, .html, ArticlePasteboardWriter.articleUTIInternalType] types += [.string, .html, ArticlePasteboardWriter.articleUTIInternalType]

@ -65,7 +65,7 @@ struct TimelineCellAppearance: Equatable {
extension NSEdgeInsets: @retroactive Equatable { extension NSEdgeInsets: @retroactive Equatable {
public static func ==(lhs: NSEdgeInsets, rhs: NSEdgeInsets) -> Bool { public static func == (lhs: NSEdgeInsets, rhs: NSEdgeInsets) -> Bool {
return lhs.left == rhs.left && lhs.top == rhs.top && lhs.right == rhs.right && lhs.bottom == rhs.bottom return lhs.left == rhs.left && lhs.top == rhs.top && lhs.right == rhs.right && lhs.bottom == rhs.bottom
} }
} }

@ -299,7 +299,11 @@ private extension TimelineTableCellView {
} }
func showOrHideView(_ view: NSView, _ shouldHide: Bool) { func showOrHideView(_ view: NSView, _ shouldHide: Bool) {
shouldHide ? hideView(view) : showView(view) if shouldHide {
hideView(view)
} else {
showView(view)
}
} }
func updateSubviews() { func updateSubviews() {

@ -107,7 +107,7 @@ final class TimelineContainerViewController: NSViewController {
return false return false
} }
for object in representedObjects { for object in representedObjects {
guard let _ = currentObjects.firstIndex(where: { $0 === object }) else { guard currentObjects.firstIndex(where: { $0 === object }) != nil else {
return false return false
} }
} }

@ -557,10 +557,7 @@ final class TimelineViewController: NSViewController, UndoableCommandRunner, Unr
} }
func canGoToNextUnread(wrappingToTop wrapping: Bool = false) -> Bool { func canGoToNextUnread(wrappingToTop wrapping: Bool = false) -> Bool {
guard let _ = indexOfNextUnreadArticle(wrappingToTop: wrapping) else { indexOfNextUnreadArticle(wrappingToTop: wrapping) != nil
return false
}
return true
} }
func indexOfNextUnreadArticle(wrappingToTop wrapping: Bool = false) -> Int? { func indexOfNextUnreadArticle(wrappingToTop wrapping: Bool = false) -> Int? {

@ -96,7 +96,5 @@ final class AccountsDetailViewController: NSViewController, NSTextFieldDelegate
default: default:
break break
} }
} }
} }

@ -12,7 +12,7 @@ import SwiftUI
import RSCore import RSCore
// MARK: - AccountsPreferencesAddAccountDelegate // MARK: - AccountsPreferencesAddAccountDelegate
protocol AccountsPreferencesAddAccountDelegate { protocol AccountsPreferencesAddAccountDelegate: AnyObject {
func presentSheetForAccount(_ accountType: AccountType) func presentSheetForAccount(_ accountType: AccountType)
} }
@ -22,7 +22,7 @@ final class AccountsPreferencesViewController: NSViewController {
@IBOutlet weak var tableView: NSTableView! @IBOutlet weak var tableView: NSTableView!
@IBOutlet weak var detailView: NSView! @IBOutlet weak var detailView: NSView!
@IBOutlet weak var deleteButton: NSButton! @IBOutlet weak var deleteButton: NSButton!
var addAccountDelegate: AccountsPreferencesAddAccountDelegate? weak var addAccountDelegate: AccountsPreferencesAddAccountDelegate?
var addAccountWindowController: NSWindowController? var addAccountWindowController: NSWindowController?
var addAccountsViewController: NSHostingController<AddAccountsView>? var addAccountsViewController: NSHostingController<AddAccountsView>?

@ -12,7 +12,7 @@ import Account
struct AddAccountHelpView: View { struct AddAccountHelpView: View {
let accountTypes: [AccountType] = AddAccountSections.allOrdered.sectionContent let accountTypes: [AccountType] = AddAccountSections.allOrdered.sectionContent
var delegate: AccountsPreferencesAddAccountDelegate? weak var delegate: AccountsPreferencesAddAccountDelegate?
var helpText: String var helpText: String
@State private var iCloudUnavailableError: Bool = false @State private var iCloudUnavailableError: Bool = false

@ -74,7 +74,7 @@ enum AddAccountSections: Int, CaseIterable {
struct AddAccountsView: View { struct AddAccountsView: View {
weak var parent: NSHostingController<AddAccountsView>? // required because presentationMode.dismiss() doesn't work weak var parent: NSHostingController<AddAccountsView>? // required because presentationMode.dismiss() doesn't work
var addAccountDelegate: AccountsPreferencesAddAccountDelegate? weak var addAccountDelegate: AccountsPreferencesAddAccountDelegate?
private let chunkLimit = 4 // use this to control number of accounts in each web account column private let chunkLimit = 4 // use this to control number of accounts in each web account column
@State private var selectedAccount: AccountType = .onMyMac @State private var selectedAccount: AccountType = .onMyMac

@ -10,6 +10,5 @@ import Foundation
struct Constants { struct Constants {
// swiftlint:disable:next line_length
static let prototypeText = "You are about to being reading Italo Calvinos new novel, *If on a winters night a traveler*. Relax. Concentrate. Dispel every other thought. Let the world around you fade. Best to close the door; the TV is always on in the next room. Tell the others right away, “No, I dont want to watch TV!” Raise your voice—they wont hear you otherwise—“Im reading! I dont want to be disturbed!” Maybe they havent heard you, with all that racket; speak louder, yell: “Im beginning to read Italo Calvinos new novel!” Or if you prefer, dont say anything; just hope theyll leave you alone. Find the most comfortable position: seated, stretched out, curled up, or lying flat. Flat on your back, on your side, on your stomach. In an easy chair, on the sofa, in the rocker, the deck chair, on the hassock. In the hammock, if you have a hammock. On top of your bed, of course, or in the bed. You can even stand on your hands, head down, in the yoga position. With the book upside down, naturally." static let prototypeText = "You are about to being reading Italo Calvinos new novel, *If on a winters night a traveler*. Relax. Concentrate. Dispel every other thought. Let the world around you fade. Best to close the door; the TV is always on in the next room. Tell the others right away, “No, I dont want to watch TV!” Raise your voice—they wont hear you otherwise—“Im reading! I dont want to be disturbed!” Maybe they havent heard you, with all that racket; speak louder, yell: “Im beginning to read Italo Calvinos new novel!” Or if you prefer, dont say anything; just hope theyll leave you alone. Find the most comfortable position: seated, stretched out, curled up, or lying flat. Flat on your back, on your side, on your stomach. In an easy chair, on the sofa, in the rocker, the deck chair, on the hassock. In the hammock, if you have a hammock. On top of your bed, of course, or in the bed. You can even stand on your hands, head down, in the yoga position. With the book upside down, naturally."
} }

@ -7,7 +7,7 @@ import Foundation
// MARK: - Strings // MARK: - Strings
// swiftlint:disable explicit_type_interface function_parameter_count identifier_name line_length // swiftlint:disable explicit_type_interface function_parameter_count identifier_name
// swiftlint:disable nesting type_body_length type_name vertical_whitespace_opening_braces // swiftlint:disable nesting type_body_length type_name vertical_whitespace_opening_braces
internal enum L10n { internal enum L10n {
/// Plural format key: "%#@localized_count@" /// Plural format key: "%#@localized_count@"
@ -61,7 +61,7 @@ internal enum L10n {
return L10n.tr("Localizable", "UnreadCount", p1) return L10n.tr("Localizable", "UnreadCount", p1)
} }
} }
// swiftlint:enable explicit_type_interface function_parameter_count identifier_name line_length // swiftlint:enable explicit_type_interface function_parameter_count identifier_name
// swiftlint:enable nesting type_body_length type_name vertical_whitespace_opening_braces // swiftlint:enable nesting type_body_length type_name vertical_whitespace_opening_braces
// MARK: - Implementation Details // MARK: - Implementation Details

@ -8,7 +8,6 @@
import UIKit import UIKit
// swiftlint:disable:next line_length
class MainTimelineDataSource<SectionIdentifierType, ItemIdentifierType>: UITableViewDiffableDataSource<SectionIdentifierType, ItemIdentifierType> where SectionIdentifierType: Hashable, ItemIdentifierType: Hashable { class MainTimelineDataSource<SectionIdentifierType, ItemIdentifierType>: UITableViewDiffableDataSource<SectionIdentifierType, ItemIdentifierType> where SectionIdentifierType: Hashable, ItemIdentifierType: Hashable {
override func tableView(_ tableView: UITableView, canEditRowAt indexPath: IndexPath) -> Bool { override func tableView(_ tableView: UITableView, canEditRowAt indexPath: IndexPath) -> Bool {