diff --git a/.swiftlint.yml b/.swiftlint.yml index b24e7660e..ce6e4cc7a 100644 --- a/.swiftlint.yml +++ b/.swiftlint.yml @@ -9,10 +9,13 @@ disabled_rules: - line_length - type_name - implicit_getter - - function_parameter_count - trailing_comma - nesting - opening_brace + - function_parameter_count + - function_body_length + - file_length + - type_body_length opt_in_rules: - file_header @@ -40,15 +43,11 @@ analyzer_rules: # Rules run by `swiftlint analyze` - explicit_self # Rule Config +cyclomatic_complexity: + ignores_case_statements: true identifier_name: min_length: 1 max_length: 1000 -file_length: - warning: 1200 - error: 1200 -type_body_length: - warning: 500 - error: 500 large_tuple: warning: 4 error: 5 diff --git a/.swiftpm/xcode/xcshareddata/xcschemes/BrowserServicesKit-Package.xcscheme b/.swiftpm/xcode/xcshareddata/xcschemes/BrowserServicesKit-Package.xcscheme index f4c568abd..5d23935cc 100644 --- a/.swiftpm/xcode/xcshareddata/xcschemes/BrowserServicesKit-Package.xcscheme +++ b/.swiftpm/xcode/xcshareddata/xcschemes/BrowserServicesKit-Package.xcscheme @@ -1,7 +1,7 @@ + version = "1.7"> + + + + + + + + + version = "1.7"> BookmarkEntity { var entity: BookmarkEntity! @@ -319,4 +317,3 @@ public extension BookmarkEntity { } // swiftlint:enable force_try -// swiftlint:enable function_body_length diff --git a/Sources/BookmarksTestsUtils/BookmarkTree.swift b/Sources/BookmarksTestsUtils/BookmarkTree.swift index 08ab69bda..312fc1893 100644 --- a/Sources/BookmarksTestsUtils/BookmarkTree.swift +++ b/Sources/BookmarksTestsUtils/BookmarkTree.swift @@ -21,7 +21,6 @@ import CoreData import Foundation import XCTest -// swiftlint:disable cyclomatic_complexity function_body_length public struct ModifiedAtConstraint { var check: (Date?) -> Void @@ -261,12 +260,19 @@ public struct BookmarkTree { public extension BookmarkEntity { @discardableResult - static func make(with treeNode: BookmarkTreeNode, rootFolder: BookmarkEntity, favoritesFolders: [BookmarkEntity], in context: NSManagedObjectContext) -> BookmarkEntity { + static func make(with treeNode: BookmarkTreeNode, + rootFolder: BookmarkEntity, + favoritesFolders: [BookmarkEntity], + in context: NSManagedObjectContext) -> BookmarkEntity { makeWithModifiedAtConstraints(with: treeNode, rootFolder: rootFolder, favoritesFolders: favoritesFolders, in: context).0 } @discardableResult - static func makeWithModifiedAtConstraints(with treeNode: BookmarkTreeNode, rootFolder: BookmarkEntity, favoritesFolders: [BookmarkEntity], in context: NSManagedObjectContext) -> (BookmarkEntity, [String: ModifiedAtConstraint]) { + // swiftlint:disable:next cyclomatic_complexity + static func makeWithModifiedAtConstraints(with treeNode: BookmarkTreeNode, + rootFolder: BookmarkEntity, + favoritesFolders: [BookmarkEntity], + in context: NSManagedObjectContext) -> (BookmarkEntity, [String: ModifiedAtConstraint]) { var entity: BookmarkEntity! var queues: [[BookmarkTreeNode]] = [[treeNode]] @@ -405,4 +411,3 @@ public extension XCTestCase { } } } -// swiftlint:enable cyclomatic_complexity function_body_length diff --git a/Sources/BrowserServicesKit/Autofill/AutofillUserScript.swift b/Sources/BrowserServicesKit/Autofill/AutofillUserScript.swift index a140494c7..dd2f379c7 100644 --- a/Sources/BrowserServicesKit/Autofill/AutofillUserScript.swift +++ b/Sources/BrowserServicesKit/Autofill/AutofillUserScript.swift @@ -113,7 +113,6 @@ public class AutofillUserScript: NSObject, UserScript, UserScriptMessageEncrypti return jsonString }() - // swiftlint:disable:next cyclomatic_complexity public func messageHandlerFor(_ messageName: String) -> MessageHandler? { guard let message = MessageName(rawValue: messageName) else { os_log("Failed to parse Autofill User Script message: '%{public}s'", log: .userScripts, type: .debug, messageName) diff --git a/Sources/BrowserServicesKit/ContentBlocking/UserScripts/ContentBlockerRulesUserScript.swift b/Sources/BrowserServicesKit/ContentBlocking/UserScripts/ContentBlockerRulesUserScript.swift index 108ca597d..ad2bc44e8 100644 --- a/Sources/BrowserServicesKit/ContentBlocking/UserScripts/ContentBlockerRulesUserScript.swift +++ b/Sources/BrowserServicesKit/ContentBlocking/UserScripts/ContentBlockerRulesUserScript.swift @@ -118,7 +118,7 @@ open class ContentBlockerRulesUserScript: NSObject, UserScript { return temporaryUnprotectedDomains } - // swiftlint:disable:next cyclomatic_complexity function_body_length + // swiftlint:disable:next cyclomatic_complexity public func userContentController(_ userContentController: WKUserContentController, didReceive message: WKScriptMessage) { guard let delegate = delegate else { return } guard delegate.contentBlockerRulesUserScriptShouldProcessTrackers(self) else { return } diff --git a/Sources/BrowserServicesKit/Email/EmailManager.swift b/Sources/BrowserServicesKit/Email/EmailManager.swift index 91548f6b1..112b0a2f2 100644 --- a/Sources/BrowserServicesKit/Email/EmailManager.swift +++ b/Sources/BrowserServicesKit/Email/EmailManager.swift @@ -88,7 +88,6 @@ public enum EmailManagerRequestDelegateError: Error { case decodingError } -// swiftlint:disable function_parameter_count public protocol EmailManagerRequestDelegate: AnyObject { var activeTask: URLSessionTask? { get set } @@ -106,7 +105,6 @@ public protocol EmailManagerRequestDelegate: AnyObject { error: EmailKeychainAccessError) } -// swiftlint:enable function_parameter_count public extension Notification.Name { static let emailDidSignIn = Notification.Name("com.duckduckgo.browserServicesKit.EmailDidSignIn") diff --git a/Sources/BrowserServicesKit/LinkProtection/LinkProtection.swift b/Sources/BrowserServicesKit/LinkProtection/LinkProtection.swift index fe23aeb1a..010628f79 100644 --- a/Sources/BrowserServicesKit/LinkProtection/LinkProtection.swift +++ b/Sources/BrowserServicesKit/LinkProtection/LinkProtection.swift @@ -91,7 +91,6 @@ public struct LinkProtection { } } - // swiftlint:disable function_parameter_count public func requestTrackingLinkRewrite(initiatingURL: URL?, destinationRequest: URLRequest, onStartExtracting: () -> Void, @@ -147,7 +146,6 @@ public struct LinkProtection { onLinkRewrite: { onLinkRewrite($0, navigationAction) }, policyDecisionHandler: { policyDecisionHandler($0 ? .allow : .cancel) }) } - // swiftlint:enable function_parameter_count @MainActor public func requestTrackingLinkRewrite(initiatingURL: URL?, diff --git a/Sources/BrowserServicesKit/SecureVault/AutofillDatabaseProvider.swift b/Sources/BrowserServicesKit/SecureVault/AutofillDatabaseProvider.swift index d86104389..c5890bc62 100644 --- a/Sources/BrowserServicesKit/SecureVault/AutofillDatabaseProvider.swift +++ b/Sources/BrowserServicesKit/SecureVault/AutofillDatabaseProvider.swift @@ -21,8 +21,6 @@ import Foundation import GRDB import SecureStorage -// swiftlint:disable file_length - public protocol AutofillDatabaseProvider: SecureStorageDatabaseProvider { func accounts() throws -> [SecureVaultModels.WebsiteAccount] @@ -825,7 +823,6 @@ extension DefaultAutofillDatabaseProvider { } - // swiftlint:disable:next function_body_length static func migrateV6(database: Database) throws { try database.alter(table: SecureVaultModels.Identity.databaseTableName) { @@ -1366,5 +1363,3 @@ extension SecureVaultModels.Identity: PersistableRecord, FetchableRecord { public static var databaseTableName: String = "identities" } - -// swiftlint:enable file_length diff --git a/Sources/BrowserServicesKit/SecureVault/SecureVaultManager.swift b/Sources/BrowserServicesKit/SecureVault/SecureVaultManager.swift index 8fd8f3ebd..3a51925f3 100644 --- a/Sources/BrowserServicesKit/SecureVault/SecureVaultManager.swift +++ b/Sources/BrowserServicesKit/SecureVault/SecureVaultManager.swift @@ -201,7 +201,7 @@ extension SecureVaultManager: AutofillSecureVaultDelegate { delegate?.secureVaultManager(self, didRequestPasswordManagerForDomain: domain) } - // swiftlint:disable:next cyclomatic_complexity function_body_length + // swiftlint:disable:next cyclomatic_complexity public func autofillUserScript(_: AutofillUserScript, didRequestStoreDataForDomain domain: String, data: AutofillUserScript.DetectedAutofillData) { @@ -338,7 +338,6 @@ extension SecureVaultManager: AutofillSecureVaultDelegate { } - // swiftlint:disable function_body_length public func autofillUserScript(_: AutofillUserScript, didRequestCredentialsForDomain domain: String, subType: AutofillUserScript.GetAutofillDataSubType, @@ -404,7 +403,6 @@ extension SecureVaultManager: AutofillSecureVaultDelegate { completionHandler(nil, credentialsProvider, .none) } } - // swiftlint:enable function_body_length public func autofillUserScript(_: AutofillUserScript, didRequestCredentialsForAccount accountId: String, diff --git a/Sources/BrowserServicesKitTestsUtils/MockEmailManagerRequestDelegate.swift b/Sources/BrowserServicesKitTestsUtils/MockEmailManagerRequestDelegate.swift index 7b3a098f5..a3aaed1b9 100644 --- a/Sources/BrowserServicesKitTestsUtils/MockEmailManagerRequestDelegate.swift +++ b/Sources/BrowserServicesKitTestsUtils/MockEmailManagerRequestDelegate.swift @@ -30,14 +30,12 @@ public class MockEmailManagerRequestDelegate: EmailManagerRequestDelegate { public var waitlistTimestamp: Int = 1 public var didSendMockAliasRequest: () -> Void - // swiftlint:disable function_parameter_count public func emailManager(_ emailManager: EmailManager, requested url: URL, method: String, headers: [String: String], parameters: [String: String]?, httpBody: Data?, timeoutInterval: TimeInterval) async throws -> Data { switch url.absoluteString { case EmailUrls.Url.emailAlias: return try processMockAliasRequest().get() default: fatalError("\(#file): Unsupported URL passed to mock request delegate: \(url)") } } - // swiftlint:enable function_parameter_count public var keychainAccessErrorAccessType: EmailKeychainAccessType? public var keychainAccessError: EmailKeychainAccessError? diff --git a/Sources/Common/Logging.swift b/Sources/Common/Logging.swift index 8347ac6c4..c7493bc73 100644 --- a/Sources/Common/Logging.swift +++ b/Sources/Common/Logging.swift @@ -111,8 +111,6 @@ extension ProcessInfo { } } -// swiftlint:disable function_parameter_count - // MARK: - message first @inlinable @@ -326,5 +324,3 @@ public func os_log(_ type: OSLogType, _ message: @autoclosure () -> String, _ vi public func os_log(_ message: @autoclosure () -> String, _ visibility: LogVisibility = .private) { os_log(.default, log: .default, message(), visibility) } - -// swiftlint:enable function_parameter_count diff --git a/Sources/DDGSync/DDGSync.swift b/Sources/DDGSync/DDGSync.swift index 9d560056d..fea085f8c 100644 --- a/Sources/DDGSync/DDGSync.swift +++ b/Sources/DDGSync/DDGSync.swift @@ -242,7 +242,6 @@ public class DDGSync: DDGSyncing { } } - // swiftlint:disable:next function_body_length private func updateAccount(_ account: SyncAccount? = nil) throws { guard account?.state != .initializing else { assertionFailure("Sync has not been initialized properly") diff --git a/Sources/DDGSync/internal/RemoteAPIRequestCreator.swift b/Sources/DDGSync/internal/RemoteAPIRequestCreator.swift index c0cf85b45..be8d07e06 100644 --- a/Sources/DDGSync/internal/RemoteAPIRequestCreator.swift +++ b/Sources/DDGSync/internal/RemoteAPIRequestCreator.swift @@ -26,7 +26,6 @@ struct RemoteAPIRequestCreator: RemoteAPIRequestCreating { self.getLog = log } - // swiftlint:disable:next function_parameter_count public func createRequest( url: URL, method: HTTPRequestMethod, diff --git a/Sources/DDGSync/internal/SyncDependencies.swift b/Sources/DDGSync/internal/SyncDependencies.swift index 06c1bd390..8a7680287 100644 --- a/Sources/DDGSync/internal/SyncDependencies.swift +++ b/Sources/DDGSync/internal/SyncDependencies.swift @@ -97,7 +97,6 @@ protocol HTTPRequesting { } protocol RemoteAPIRequestCreating { - // swiftlint:disable:next function_parameter_count func createRequest(url: URL, method: HTTPRequestMethod, headers: [String: String], diff --git a/Sources/DDGSync/internal/SyncOperation.swift b/Sources/DDGSync/internal/SyncOperation.swift index 9abe6d3dd..018c87fa3 100644 --- a/Sources/DDGSync/internal/SyncOperation.swift +++ b/Sources/DDGSync/internal/SyncOperation.swift @@ -125,7 +125,6 @@ final class SyncOperation: Operation, @unchecked Sendable { try await sync(fetchOnly: fetchOnly, dataProviders: dataProviders) } - // swiftlint:disable:next cyclomatic_complexity function_body_length func sync(fetchOnly: Bool, dataProviders: [DataProviding] = []) async throws { os_log(.debug, log: log, "Sync Operation Started. Fetch-only: %{public}s", String(fetchOnly)) defer { diff --git a/Sources/History/HistoryStore.swift b/Sources/History/HistoryStore.swift index d0d8bae31..9e3e04620 100644 --- a/Sources/History/HistoryStore.swift +++ b/Sources/History/HistoryStore.swift @@ -168,7 +168,6 @@ final public class HistoryStore: HistoryStoring { } } - // swiftlint:disable:next function_body_length public func save(entry: HistoryEntry) -> Future<[(id: Visit.ID, date: Date)], Error> { return Future { [weak self] promise in self?.context.perform { [weak self] in diff --git a/Sources/Navigation/DistributedNavigationDelegate.swift b/Sources/Navigation/DistributedNavigationDelegate.swift index de7b40daf..dac8c27a5 100644 --- a/Sources/Navigation/DistributedNavigationDelegate.swift +++ b/Sources/Navigation/DistributedNavigationDelegate.swift @@ -109,7 +109,6 @@ private extension DistributedNavigationDelegate { static var sigIntRaisedForResponders = Set() #endif - // swiftlint:disable function_parameter_count /// continues until first non-nil Navigation Responder decision and returned to the `completion` callback func makeAsyncDecision(for actionDebugInfo: some CustomDebugStringConvertible, boundToLifetimeOf webView: WKWebView, @@ -170,7 +169,6 @@ private extension DistributedNavigationDelegate { return task } - // swiftlint:enable function_parameter_count func makeAsyncDecision(for actionDebugInfo: some CustomDebugStringConvertible, boundToLifetimeOf webView: WKWebView, @@ -310,8 +308,7 @@ extension DistributedNavigationDelegate: WKNavigationDelegate { // MARK: Policy making @MainActor - // swiftlint:disable function_body_length - // swiftlint:disable cyclomatic_complexity + // swiftlint:disable:next cyclomatic_complexity public func webView(_ webView: WKWebView, decidePolicyFor wkNavigationAction: WKNavigationAction, preferences wkPreferences: WKWebpagePreferences, decisionHandler: @escaping (WKNavigationActionPolicy, WKWebpagePreferences) -> Void) { // new navigation or an ongoing navigation (for a server-redirect)? @@ -432,8 +429,6 @@ extension DistributedNavigationDelegate: WKNavigationDelegate { self.navigationActionDecisionTask = task } } - // swiftlint:enable function_body_length - // swiftlint:enable cyclomatic_complexity @MainActor private func willStart(_ navigation: Navigation) { @@ -643,10 +638,9 @@ extension DistributedNavigationDelegate: WKNavigationDelegate { #if WILLPERFORMCLIENTREDIRECT_ENABLED - // swiftlint:disable function_body_length - // swiftlint:disable cyclomatic_complexity @MainActor @objc(_webView:willPerformClientRedirectToURL:delay:) + // swiftlint:disable:next cyclomatic_complexity public func webView(_ webView: WKWebView, willPerformClientRedirectTo url: URL, delay: TimeInterval) { for responder in responders { responder.webViewWillPerformClientRedirect(to: url, withDelay: delay) @@ -742,8 +736,6 @@ extension DistributedNavigationDelegate: WKNavigationDelegate { // set Navigation state to .redirected and expect the redirect NavigationAction redirectedNavigation.willPerformClientRedirect(to: url, delay: delay) } - // swiftlint:enable function_body_length - // swiftlint:enable cyclomatic_complexity @MainActor @objc(_webViewDidCancelClientRedirect:) diff --git a/Sources/Navigation/NavigationState.swift b/Sources/Navigation/NavigationState.swift index f28bc4eb4..e2e7d3279 100644 --- a/Sources/Navigation/NavigationState.swift +++ b/Sources/Navigation/NavigationState.swift @@ -62,7 +62,6 @@ public enum NavigationState: Equatable, Comparable { isFinished || isFailed } - // swiftlint:disable:next cyclomatic_complexity public static func == (lhs: NavigationState, rhs: NavigationState) -> Bool { switch lhs { case .expected(let navigationType): if case .expected(navigationType) = rhs { return true } diff --git a/Sources/NetworkProtection/ExtensionMessage/ExtensionMessage.swift b/Sources/NetworkProtection/ExtensionMessage/ExtensionMessage.swift index dd00d0aa3..7d53a266b 100644 --- a/Sources/NetworkProtection/ExtensionMessage/ExtensionMessage.swift +++ b/Sources/NetworkProtection/ExtensionMessage/ExtensionMessage.swift @@ -70,7 +70,6 @@ public enum ExtensionMessage: RawRepresentable { case simulateConnectionInterruption case getDataVolume - // swiftlint:disable:next cyclomatic_complexity function_body_length public init?(rawValue data: Data) { let name = data.first.flatMap(Name.init(rawValue:)) switch name { diff --git a/Sources/NetworkProtection/NetworkProtectionDeviceManager.swift b/Sources/NetworkProtection/NetworkProtectionDeviceManager.swift index d8df572c1..d22fac7b7 100644 --- a/Sources/NetworkProtection/NetworkProtectionDeviceManager.swift +++ b/Sources/NetworkProtection/NetworkProtectionDeviceManager.swift @@ -316,7 +316,6 @@ public actor NetworkProtectionDeviceManager: NetworkProtectionDeviceManagement { return peerConfiguration } - // swiftlint:disable function_parameter_count func interfaceConfiguration(privateKey: PrivateKey, addressRange: IPAddressRange, includedRoutes: [IPAddressRange], @@ -336,7 +335,6 @@ public actor NetworkProtectionDeviceManager: NetworkProtectionDeviceManagement { listenPort: 51821, dns: dns) } - // swiftlint:enable function_parameter_count private func handle(clientError: NetworkProtectionClientError) { #if os(macOS) diff --git a/Sources/NetworkProtection/Networking/Pinger.swift b/Sources/NetworkProtection/Networking/Pinger.swift index bdb70981e..e92606bb9 100644 --- a/Sources/NetworkProtection/Networking/Pinger.swift +++ b/Sources/NetworkProtection/Networking/Pinger.swift @@ -231,7 +231,6 @@ public extension Pinger { case decrypt_failed = 3 // decrypt failed } - // swiftlint:disable:next cyclomatic_complexity public init?(type: u_char, code: u_char) { switch type { case 0: diff --git a/Sources/NetworkProtection/PacketTunnelProvider.swift b/Sources/NetworkProtection/PacketTunnelProvider.swift index 1111d62f5..fb6496359 100644 --- a/Sources/NetworkProtection/PacketTunnelProvider.swift +++ b/Sources/NetworkProtection/PacketTunnelProvider.swift @@ -19,15 +19,12 @@ // SPDX-License-Identifier: MIT // Copyright © 2018-2021 WireGuard LLC. All Rights Reserved. -// swiftlint:disable file_length - import Combine import Common import Foundation import NetworkExtension import UserNotifications -// swiftlint:disable:next type_body_length open class PacketTunnelProvider: NEPacketTunnelProvider { public enum Event { @@ -968,7 +965,6 @@ open class PacketTunnelProvider: NEPacketTunnelProvider { // MARK: - App Messages - // swiftlint:disable:next cyclomatic_complexity @MainActor public override func handleAppMessage(_ messageData: Data, completionHandler: ((Data?) -> Void)? = nil) { guard let message = ExtensionMessage(rawValue: messageData) else { @@ -1040,7 +1036,6 @@ open class PacketTunnelProvider: NEPacketTunnelProvider { settings.apply(change: change) } - // swiftlint:disable:next cyclomatic_complexity function_body_length private func handleSettingsChange(_ change: VPNSettings.Change, completionHandler: ((Data?) -> Void)? = nil) { switch change { case .setExcludeLocalNetworks: @@ -1654,5 +1649,3 @@ extension WireGuardAdapterError: LocalizedError, CustomDebugStringConvertible { errorDescription! } } - -// swiftlint:enable file_length diff --git a/Sources/NetworkProtection/Settings/VPNSettings.swift b/Sources/NetworkProtection/Settings/VPNSettings.swift index d568b8acc..167b1e8c9 100644 --- a/Sources/NetworkProtection/Settings/VPNSettings.swift +++ b/Sources/NetworkProtection/Settings/VPNSettings.swift @@ -209,7 +209,6 @@ public final class VPNSettings { // MARK: - Applying Changes - // swiftlint:disable cyclomatic_complexity public func apply(change: Change) { switch change { case .setConnectOnLogin(let connectOnLogin): @@ -238,7 +237,6 @@ public final class VPNSettings { self.disableRekeying = disableRekeying } } - // swiftlint:enable cyclomatic_complexity // MARK: - Connect on Login diff --git a/Sources/PixelKit/PixelKit.swift b/Sources/PixelKit/PixelKit.swift index 6af7381c1..c2e760976 100644 --- a/Sources/PixelKit/PixelKit.swift +++ b/Sources/PixelKit/PixelKit.swift @@ -163,7 +163,6 @@ public final class PixelKit { logger.debug("👾 PixelKit initialised: dryRun: \(self.dryRun, privacy: .public) appVersion: \(self.appVersion, privacy: .public) source: \(self.source ?? "-", privacy: .public) defaultHeaders: \(self.defaultHeaders, privacy: .public) pixelCalendar: \(self.pixelCalendar, privacy: .public)") } - // swiftlint:disable:next function_body_length cyclomatic_complexity private func fire(pixelNamed pixelName: String, frequency: Frequency, withHeaders headers: [String: String]?, diff --git a/Sources/PrivacyDashboard/PrivacyDashboardUserScript.swift b/Sources/PrivacyDashboard/PrivacyDashboardUserScript.swift index 5c8ea5d96..d6703dcb3 100644 --- a/Sources/PrivacyDashboard/PrivacyDashboardUserScript.swift +++ b/Sources/PrivacyDashboard/PrivacyDashboardUserScript.swift @@ -141,7 +141,6 @@ final class PrivacyDashboardUserScript: NSObject, StaticUserScript { weak var delegate: PrivacyDashboardUserScriptDelegate? - // swiftlint:disable:next cyclomatic_complexity func userContentController(_ userContentController: WKUserContentController, didReceive message: WKScriptMessage) { guard let messageType = MessageNames(rawValue: message.name) else { assertionFailure("PrivacyDashboardUserScript: unexpected message name \(message.name)") diff --git a/Sources/RemoteMessaging/Mappers/DefaultRemoteMessagingSurveyURLBuilder.swift b/Sources/RemoteMessaging/Mappers/DefaultRemoteMessagingSurveyURLBuilder.swift index 2b53ad288..f57d49d6c 100644 --- a/Sources/RemoteMessaging/Mappers/DefaultRemoteMessagingSurveyURLBuilder.swift +++ b/Sources/RemoteMessaging/Mappers/DefaultRemoteMessagingSurveyURLBuilder.swift @@ -38,7 +38,7 @@ public struct DefaultRemoteMessagingSurveyURLBuilder: RemoteMessagingSurveyActio self.subscription = subscription } - // swiftlint:disable:next cyclomatic_complexity function_body_length + // swiftlint:disable:next cyclomatic_complexity public func add(parameters: [RemoteMessagingSurveyActionParameter], to surveyURL: URL) -> URL { guard var components = URLComponents(string: surveyURL.absoluteString) else { assertionFailure("Could not build URL components from survey URL") diff --git a/Sources/RemoteMessaging/Mappers/JsonToRemoteMessageModelMapper.swift b/Sources/RemoteMessaging/Mappers/JsonToRemoteMessageModelMapper.swift index 40ba57480..d02be631c 100644 --- a/Sources/RemoteMessaging/Mappers/JsonToRemoteMessageModelMapper.swift +++ b/Sources/RemoteMessaging/Mappers/JsonToRemoteMessageModelMapper.swift @@ -19,7 +19,6 @@ import Common import Foundation -// swiftlint:disable cyclomatic_complexity private enum AttributesKey: String, CaseIterable { case locale case osApi @@ -73,7 +72,6 @@ private enum AttributesKey: String, CaseIterable { } } } -// swiftlint:enable cyclomatic_complexity struct JsonToRemoteMessageModelMapper { @@ -99,7 +97,6 @@ struct JsonToRemoteMessageModelMapper { return remoteMessages } - // swiftlint:disable cyclomatic_complexity function_body_length static func mapToContent(content: RemoteMessageResponse.JsonContent, surveyActionMapper: RemoteMessagingSurveyActionMapping) -> RemoteMessageModelType? { switch RemoteMessageResponse.JsonMessageType(rawValue: content.messageType) { @@ -167,7 +164,6 @@ struct JsonToRemoteMessageModelMapper { return nil } } - // swiftlint:enable cyclomatic_complexity function_body_length static func mapToAction(_ jsonAction: RemoteMessageResponse.JsonMessageAction?, surveyActionMapper: RemoteMessagingSurveyActionMapping) -> RemoteAction? { diff --git a/Sources/RemoteMessaging/Matchers/AppAttributeMatcher.swift b/Sources/RemoteMessaging/Matchers/AppAttributeMatcher.swift index 5ad348fce..039849026 100644 --- a/Sources/RemoteMessaging/Matchers/AppAttributeMatcher.swift +++ b/Sources/RemoteMessaging/Matchers/AppAttributeMatcher.swift @@ -47,7 +47,6 @@ public struct AppAttributeMatcher: AttributeMatching { self.variantManager = variantManager } - // swiftlint:disable cyclomatic_complexity public func evaluate(matchingAttribute: MatchingAttribute) -> EvaluationResult? { switch matchingAttribute { case let matchingAttribute as IsInternalUserMatchingAttribute: @@ -95,5 +94,4 @@ public struct AppAttributeMatcher: AttributeMatching { return nil } } - // swiftlint:enable cyclomatic_complexity } diff --git a/Sources/RemoteMessaging/Matchers/UserAttributeMatcher.swift b/Sources/RemoteMessaging/Matchers/UserAttributeMatcher.swift index 33fc9952d..299dbe278 100644 --- a/Sources/RemoteMessaging/Matchers/UserAttributeMatcher.swift +++ b/Sources/RemoteMessaging/Matchers/UserAttributeMatcher.swift @@ -155,7 +155,7 @@ public struct CommonUserAttributeMatcher: AttributeMatching { self.dismissedMessageIds = dismissedMessageIds } - // swiftlint:disable:next cyclomatic_complexity function_body_length + // swiftlint:disable:next cyclomatic_complexity public func evaluate(matchingAttribute: MatchingAttribute) -> EvaluationResult? { switch matchingAttribute { case let matchingAttribute as AppThemeMatchingAttribute: diff --git a/Sources/Subscription/Flows/AppStore/AppStorePurchaseFlow.swift b/Sources/Subscription/Flows/AppStore/AppStorePurchaseFlow.swift index ff35bbcd0..4239be257 100644 --- a/Sources/Subscription/Flows/AppStore/AppStorePurchaseFlow.swift +++ b/Sources/Subscription/Flows/AppStore/AppStorePurchaseFlow.swift @@ -59,7 +59,6 @@ public final class DefaultAppStorePurchaseFlow: AppStorePurchaseFlow { self.authEndpointService = authEndpointService } - // swiftlint:disable cyclomatic_complexity public func purchaseSubscription(with subscriptionIdentifier: String, emailAccessToken: String?) async -> Result { os_log(.info, log: .subscription, "[AppStorePurchaseFlow] purchaseSubscription") let externalID: String @@ -116,7 +115,6 @@ public final class DefaultAppStorePurchaseFlow: AppStorePurchaseFlow { } } - // swiftlint:enable cyclomatic_complexity @discardableResult public func completeSubscriptionPurchase(with transactionJWS: TransactionJWS) async -> Result { diff --git a/Sources/Subscription/SubscriptionURL.swift b/Sources/Subscription/SubscriptionURL.swift index a6cd6a10e..107636f4f 100644 --- a/Sources/Subscription/SubscriptionURL.swift +++ b/Sources/Subscription/SubscriptionURL.swift @@ -33,7 +33,6 @@ public enum SubscriptionURL { case manageSubscriptionsInAppStore case identityTheftRestoration - // swiftlint:disable:next cyclomatic_complexity public func subscriptionURL(environment: SubscriptionEnvironment.ServiceEnvironment) -> URL { switch self { case .baseURL: diff --git a/Sources/Suggestions/SuggestionProcessing.swift b/Sources/Suggestions/SuggestionProcessing.swift index 667655cda..a50124d7a 100644 --- a/Sources/Suggestions/SuggestionProcessing.swift +++ b/Sources/Suggestions/SuggestionProcessing.swift @@ -148,7 +148,6 @@ final class SuggestionProcessing { // The point of this method is to prioritise duplicates that // provide a higher value or replace history suggestions with bookmark suggestions - // swiftlint:disable:next function_body_length private func merge(_ suggestions: [Suggestion], maximum: Int? = nil) -> [Suggestion] { // Finds a duplicate with the same URL and available title diff --git a/Sources/SyncDataProviders/Bookmarks/BookmarksProvider.swift b/Sources/SyncDataProviders/Bookmarks/BookmarksProvider.swift index 4d7dd6751..8f1821f4f 100644 --- a/Sources/SyncDataProviders/Bookmarks/BookmarksProvider.swift +++ b/Sources/SyncDataProviders/Bookmarks/BookmarksProvider.swift @@ -128,7 +128,6 @@ public final class BookmarksProvider: DataProvider { // MARK: - Internal - // swiftlint:disable:next function_parameter_count func handleSyncResponse(isInitial: Bool, sent: [Syncable], received: [Syncable], clientTimestamp: Date, serverTimestamp: String?, crypter: Crypting) async throws { var saveError: Error? diff --git a/Sources/SyncDataProviders/Bookmarks/internal/SyncableBookmarkAdapter.swift b/Sources/SyncDataProviders/Bookmarks/internal/SyncableBookmarkAdapter.swift index 34a2ec828..faddf3491 100644 --- a/Sources/SyncDataProviders/Bookmarks/internal/SyncableBookmarkAdapter.swift +++ b/Sources/SyncDataProviders/Bookmarks/internal/SyncableBookmarkAdapter.swift @@ -80,7 +80,7 @@ extension Syncable { static let maxEncryptedBookmarkURLLength = 3000 } - // swiftlint:disable:next cyclomatic_complexity function_body_length + // swiftlint:disable:next cyclomatic_complexity init(bookmark: BookmarkEntity, encryptedUsing encrypt: (String) throws -> String) throws { var payload: [String: Any] = [:] guard let uuid = bookmark.uuid else { diff --git a/Sources/SyncDataProviders/Credentials/CredentialsProvider.swift b/Sources/SyncDataProviders/Credentials/CredentialsProvider.swift index 020f711cd..b7feb0f91 100644 --- a/Sources/SyncDataProviders/Credentials/CredentialsProvider.swift +++ b/Sources/SyncDataProviders/Credentials/CredentialsProvider.swift @@ -138,7 +138,6 @@ public final class CredentialsProvider: DataProvider { // MARK: - Internal - // swiftlint:disable:next function_body_length function_parameter_count func handleSyncResponse(isInitial: Bool, sent: [Syncable], received: [Syncable], diff --git a/Sources/SyncDataProviders/Settings/SettingsProvider.swift b/Sources/SyncDataProviders/Settings/SettingsProvider.swift index f3b8f622e..6708427b6 100644 --- a/Sources/SyncDataProviders/Settings/SettingsProvider.swift +++ b/Sources/SyncDataProviders/Settings/SettingsProvider.swift @@ -203,7 +203,6 @@ public final class SettingsProvider: DataProvider, SettingSyncHandlingDelegate { // MARK: - Internal - // swiftlint:disable:next function_body_length function_parameter_count func handleSyncResponse( isInitial: Bool, sent: [Syncable], diff --git a/Tests/BrowserServicesKitTests/ContentBlocker/ClickToLoadBlockingTests.swift b/Tests/BrowserServicesKitTests/ContentBlocker/ClickToLoadBlockingTests.swift index b8d5df569..7002154c0 100644 --- a/Tests/BrowserServicesKitTests/ContentBlocker/ClickToLoadBlockingTests.swift +++ b/Tests/BrowserServicesKitTests/ContentBlocker/ClickToLoadBlockingTests.swift @@ -281,7 +281,6 @@ class ClickToLoadBlockingTests: XCTestCase { waitForExpectations(timeout: 30, handler: nil) } - // swiftlint:disable function_body_length private func popTestAndExecute(onTestExecuted: XCTestExpectation) { guard let test = tests.popLast() else { @@ -368,6 +367,4 @@ class ClickToLoadBlockingTests: XCTestCase { } } } - // swiftlint:enable function_body_length - } diff --git a/Tests/BrowserServicesKitTests/ContentBlocker/ContentBlockerReferenceTests.swift b/Tests/BrowserServicesKitTests/ContentBlocker/ContentBlockerReferenceTests.swift index cd6020298..ef8478910 100644 --- a/Tests/BrowserServicesKitTests/ContentBlocker/ContentBlockerReferenceTests.swift +++ b/Tests/BrowserServicesKitTests/ContentBlocker/ContentBlockerReferenceTests.swift @@ -107,7 +107,6 @@ class ContentBlockerReferenceTests: XCTestCase { waitForExpectations(timeout: 30, handler: nil) } - // swiftlint:disable function_body_length private func popTestAndExecute(onTestExecuted: XCTestExpectation) { guard let test = tests.popLast() else { @@ -203,6 +202,4 @@ class ContentBlockerReferenceTests: XCTestCase { } } } - // swiftlint:enable function_body_length - } diff --git a/Tests/BrowserServicesKitTests/ContentBlocker/ContentBlockerRulesManagerInitialCompilationTests.swift b/Tests/BrowserServicesKitTests/ContentBlocker/ContentBlockerRulesManagerInitialCompilationTests.swift index f197328a1..004d373e4 100644 --- a/Tests/BrowserServicesKitTests/ContentBlocker/ContentBlockerRulesManagerInitialCompilationTests.swift +++ b/Tests/BrowserServicesKitTests/ContentBlocker/ContentBlockerRulesManagerInitialCompilationTests.swift @@ -183,7 +183,6 @@ final class ContentBlockerRulesManagerInitialCompilationTests: XCTestCase { wait(for: [expCacheLookup, expNext], timeout: 15.0) } - // swiftlint:disable:next function_body_length func testInitialCompilation_WhenThereAreChangesToTDS_ShouldBuildRulesUsingLastCompiledRulesAndScheduleRecompilationWithNewSource() { let oldEtag = ContentBlockerRulesManagerTests.makeEtag() diff --git a/Tests/BrowserServicesKitTests/ContentBlocker/TrackerAllowlistReferenceTests.swift b/Tests/BrowserServicesKitTests/ContentBlocker/TrackerAllowlistReferenceTests.swift index b7a2f2523..9bfc87066 100644 --- a/Tests/BrowserServicesKitTests/ContentBlocker/TrackerAllowlistReferenceTests.swift +++ b/Tests/BrowserServicesKitTests/ContentBlocker/TrackerAllowlistReferenceTests.swift @@ -132,7 +132,6 @@ class TrackerAllowlistReferenceTests: XCTestCase { waitForExpectations(timeout: 30, handler: nil) } - // swiftlint:disable function_body_length private func popTestAndExecute(onTestExecuted: XCTestExpectation) { guard let test = tests.popLast() else { @@ -209,6 +208,4 @@ class TrackerAllowlistReferenceTests: XCTestCase { } } } - // swiftlint:enable function_body_length - } diff --git a/Tests/BrowserServicesKitTests/ContentBlocker/TrackerDataManagerTests.swift b/Tests/BrowserServicesKitTests/ContentBlocker/TrackerDataManagerTests.swift index 03ad89539..69cab4ad0 100644 --- a/Tests/BrowserServicesKitTests/ContentBlocker/TrackerDataManagerTests.swift +++ b/Tests/BrowserServicesKitTests/ContentBlocker/TrackerDataManagerTests.swift @@ -124,7 +124,6 @@ class TrackerDataManagerTests: XCTestCase { XCTAssertEqual("Not Real", entity?.displayName) } - // swiftlint:disable function_body_length func testWhenDownloadedDataAvailableThenReloadUsesIt() { let exampleData = Self.exampleTDS.data(using: .utf8)! @@ -144,5 +143,4 @@ class TrackerDataManagerTests: XCTestCase { XCTAssertNotNil(trackerDataManager.fetchedData?.tds.findEntity(byName: "Not Real")) } - // swiftlint:enable function_body_length }