diff --git a/.swiftlint.yml b/.swiftlint.yml index a8644ec2c..963794106 100644 --- a/.swiftlint.yml +++ b/.swiftlint.yml @@ -10,6 +10,8 @@ line_length: disabled_rules: - todo + - for_where + - file_length excluded: - Modules/Secrets/Sources/Secrets/SecretKey.swift diff --git a/Shared/Favicons/ColorHash.swift b/Shared/Favicons/ColorHash.swift index 33f5b62d9..920dfa6c3 100644 --- a/Shared/Favicons/ColorHash.swift +++ b/Shared/Favicons/ColorHash.swift @@ -51,23 +51,23 @@ public class ColorHash { public var HSB: (CGFloat, CGFloat, CGFloat) { var hash = CGFloat(bkdrHash) - let H = hash.truncatingRemainder(dividingBy: (full - 1.0)) / full + let h = hash.truncatingRemainder(dividingBy: (full - 1.0)) / full hash /= full - let S = saturation[Int((full * hash).truncatingRemainder(dividingBy: CGFloat(saturation.count)))] + let s = saturation[Int((full * hash).truncatingRemainder(dividingBy: CGFloat(saturation.count)))] hash /= CGFloat(saturation.count) - let B = brightness[Int((full * hash).truncatingRemainder(dividingBy: CGFloat(brightness.count)))] - return (H, S, B) + let b = brightness[Int((full * hash).truncatingRemainder(dividingBy: CGFloat(brightness.count)))] + return (h, s, b) } #if os(iOS) || os(tvOS) || os(watchOS) public var color: UIColor { - let (H, S, B) = HSB - return UIColor(hue: H, saturation: S, brightness: B, alpha: 1.0) + let (h, s, b) = HSB + return UIColor(hue: h, saturation: s, brightness: b, alpha: 1.0) } #elseif os(OSX) public var color: NSColor { - let (H, S, B) = HSB - return NSColor(hue: H, saturation: S, brightness: B, alpha: 1.0) + let (h, s, b) = HSB + return NSColor(hue: h, saturation: s, brightness: b, alpha: 1.0) } #endif diff --git a/Shared/Favicons/SingleFaviconDownloader.swift b/Shared/Favicons/SingleFaviconDownloader.swift index f9fbba4c3..308695356 100644 --- a/Shared/Favicons/SingleFaviconDownloader.swift +++ b/Shared/Favicons/SingleFaviconDownloader.swift @@ -55,7 +55,7 @@ final class SingleFaviconDownloader { // If we don’t have an image, and lastDownloadAttemptDate is a while ago, try again. - if let _ = iconImage { + if iconImage != nil { return false } diff --git a/Shared/SmartFeeds/SmartFeedDelegate.swift b/Shared/SmartFeeds/SmartFeedDelegate.swift index ef5b10183..7d029deac 100644 --- a/Shared/SmartFeeds/SmartFeedDelegate.swift +++ b/Shared/SmartFeeds/SmartFeedDelegate.swift @@ -12,6 +12,7 @@ import Articles import ArticlesDatabase import RSCore +// swiftlint:disable:next class_delegate_protocol protocol SmartFeedDelegate: SidebarItemIdentifiable, DisplayNameProvider, ArticleFetcher, SmallIconProvider { var fetchType: FetchType { get } func fetchUnreadCount(for: Account, completion: @escaping SingleUnreadCountCompletionBlock) diff --git a/Shared/Tree/FeedTreeControllerDelegate.swift b/Shared/Tree/FeedTreeControllerDelegate.swift index ed8ce901e..a6a7ccac5 100644 --- a/Shared/Tree/FeedTreeControllerDelegate.swift +++ b/Shared/Tree/FeedTreeControllerDelegate.swift @@ -62,6 +62,7 @@ private extension FeedTreeControllerDelegate { } func childNodesForContainerNode(_ containerNode: Node) -> [Node]? { + // swiftlint:disable:next force_cast let container = containerNode.representedObject as! Container var children = [AnyObject]() diff --git a/Shared/Widget/WidgetDataDecoder.swift b/Shared/Widget/WidgetDataDecoder.swift index a7f57064e..5820da049 100644 --- a/Shared/Widget/WidgetDataDecoder.swift +++ b/Shared/Widget/WidgetDataDecoder.swift @@ -11,6 +11,7 @@ import Foundation struct WidgetDataDecoder { static func decodeWidgetData() throws -> WidgetData { + // swiftlint:disable:next force_cast let appGroup = Bundle.main.object(forInfoDictionaryKey: "AppGroup") as! String let containerURL = FileManager.default.containerURL(forSecurityApplicationGroupIdentifier: appGroup) let dataURL = containerURL?.appendingPathComponent("widget-data.json")