From 98aaee032f86043dc3f51055ad338ebceb8a221e Mon Sep 17 00:00:00 2001 From: Federico Cappelli Date: Wed, 10 Jul 2024 12:18:41 +0100 Subject: [PATCH] Swiftlint refactoring (#2952) Task/Issue URL: https://app.asana.com/0/1205842942115003/1207743897886423/f What kind of version bump will this require?: No version bump Swiftlint rules disabled: - line_length - function_parameter_count - function_body_length - file_length - type_body_length removed cyclomatic_complexity disabled only for switch cases and superfluous disable removed --- .swiftlint.yml | 15 ++- .../xcschemes/sandbox-test-tool.xcscheme | 2 +- DuckDuckGo/Application/AppDelegate.swift | 4 - .../LegacyBookmarksStoreMigration.swift | 5 +- .../Services/LocalBookmarkStore.swift | 2 - .../View/BookmarkListViewController.swift | 2 +- ...okmarkManagementDetailViewController.swift | 1 - .../Surveys/SurveyRemoteMessaging.swift | 4 +- .../Common/Surveys/SurveyURLBuilder.swift | 2 +- .../DBP/DataBrokerProtectionDebugMenu.swift | 1 - .../DataBrokerProtectionPixelsHandler.swift | 1 - .../DataImport/Logins/CSV/CSVParser.swift | 1 - .../Model/DataImportViewModel.swift | 2 +- .../Model/InstructionsFormatParser.swift | 1 - DuckDuckGo/DataImport/ThirdPartyBrowser.swift | 2 - .../DataImport/View/DataImportView.swift | 2 - .../DataImport/View/FileImportView.swift | 3 - .../Email/EmailManagerRequestDelegate.swift | 2 - .../FileDownload/View/DownloadsCellView.swift | 1 - .../View/DownloadsViewController.swift | 5 +- .../Services/EncryptedHistoryStore.swift | 1 - .../Model/HomePageRecentlyVisitedModel.swift | 1 - DuckDuckGo/Menus/MainMenu.swift | 5 +- DuckDuckGo/Menus/MainMenuActions.swift | 5 - .../AddressBarButtonsViewController.swift | 1 - .../View/AddressBarTextField.swift | 1 - .../View/NavigationBarViewController.swift | 1 - .../ViewModel/PrivacyIconViewModel.swift | 3 - .../NetworkProtectionDebugMenu.swift | 1 - ...etworkProtectionNavBarPopoverManager.swift | 1 - .../NetworkProtectionTunnelController.swift | 1 - .../MacPacketTunnelProvider.swift | 2 - .../Bitwarden/Model/BWManager.swift | 4 - .../View/ConnectBitwardenViewModel.swift | 2 - .../Permissions/Model/PermissionState.swift | 2 - .../Preferences/Model/SyncPreferences.swift | 1 - .../View/PreferencesAutofillView.swift | 4 - .../View/PreferencesRootView.swift | 1 - ...RemoteMessagingConfigMatcherProvider.swift | 1 - .../PasswordManagementViewController.swift | 5 - .../StateRestoration/Tab+NSSecureCoding.swift | 1 - DuckDuckGo/Statistics/GeneralPixel.swift | 3 - DuckDuckGo/Sync/SyncErrorHandler.swift | 2 - DuckDuckGo/Tab/Model/Tab.swift | 6 - DuckDuckGo/Tab/Model/TabContent.swift | 1 - .../Navigation/ExternalAppSchemeHandler.swift | 1 - .../Tab/TabExtensions/TabExtensions.swift | 2 - .../SubscriptionErrorReporter.swift | 1 - ...scriptionPagesUseSubscriptionFeature.swift | 2 - DuckDuckGo/Tab/UserScripts/UserScripts.swift | 1 - .../Tab/View/BrowserTabViewController.swift | 4 - DuckDuckGo/Tab/ViewModel/TabViewModel.swift | 3 +- .../TabBar/View/TabBarViewController.swift | 4 - .../ViewModel/TabCollectionViewModel.swift | 1 - DuckDuckGo/YoutubePlayer/DuckPlayer.swift | 1 - Gemfile | 2 +- Gemfile.lock | 123 ++++++++++-------- .../Model/CCFRequestParameters.swift | 1 - .../Operations/DataBrokerJob.swift | 1 - ...taBrokerProfileQueryOperationManager.swift | 3 +- .../Pixels/DataBrokerProtectionPixels.swift | 1 - .../DataBrokerProtectionAgentManager.swift | 2 +- ...DataBrokerProtectionDatabaseProvider.swift | 3 - .../UI/DBPUICommunicationLayer.swift | 1 - .../BrokerJSONCodableTests.swift | 2 - ...kerProfileQueryOperationManagerTests.swift | 4 - .../Sources/UDSHelper/UDSReceiver.swift | 1 - .../DataImport/DataImportViewModelTests.swift | 1 - .../Tab/Services/FaviconManagerMock.swift | 1 - 69 files changed, 89 insertions(+), 191 deletions(-) diff --git a/.swiftlint.yml b/.swiftlint.yml index 40a316303d..459bfc874e 100644 --- a/.swiftlint.yml +++ b/.swiftlint.yml @@ -9,10 +9,15 @@ 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 + - non_optional_string_data_conversion + - static_over_final_class opt_in_rules: - file_header @@ -37,15 +42,11 @@ custom_rules: severity: error # 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/DuckDuckGo.xcodeproj/xcshareddata/xcschemes/sandbox-test-tool.xcscheme b/DuckDuckGo.xcodeproj/xcshareddata/xcschemes/sandbox-test-tool.xcscheme index eb7e5e26bb..41730d7069 100644 --- a/DuckDuckGo.xcodeproj/xcshareddata/xcschemes/sandbox-test-tool.xcscheme +++ b/DuckDuckGo.xcodeproj/xcshareddata/xcschemes/sandbox-test-tool.xcscheme @@ -1,7 +1,7 @@ + version = "1.7"> = Date.weekAgo } - // swiftlint:disable:next function_body_length override init() { do { let encryptionKey = NSApplication.runType.requiresEnvironment ? try keyStore.readKey() : nil @@ -278,7 +275,6 @@ final class AppDelegate: NSObject, NSApplicationDelegate { vpnUninstaller: vpnUninstaller) } - // swiftlint:disable:next function_body_length func applicationDidFinishLaunching(_ notification: Notification) { guard NSApp.runType.requiresEnvironment else { return } defer { diff --git a/DuckDuckGo/Bookmarks/Legacy/LegacyBookmarksStoreMigration.swift b/DuckDuckGo/Bookmarks/Legacy/LegacyBookmarksStoreMigration.swift index 734275e1c5..ad7cf4fc1c 100644 --- a/DuckDuckGo/Bookmarks/Legacy/LegacyBookmarksStoreMigration.swift +++ b/DuckDuckGo/Bookmarks/Legacy/LegacyBookmarksStoreMigration.swift @@ -44,8 +44,7 @@ public class LegacyBookmarksStoreMigration { return results } - // swiftlint:disable cyclomatic_complexity - // swiftlint:disable function_body_length + // swiftlint:disable:next cyclomatic_complexity public static func setupAndMigrate(from source: NSManagedObjectContext, to destination: NSManagedObjectContext) { @@ -173,8 +172,6 @@ public class LegacyBookmarksStoreMigration { } } } - // swiftlint:enable cyclomatic_complexity - // swiftlint:enable function_body_length private static func cleanupOldData(in context: NSManagedObjectContext) { let allObjects = (try? context.fetch(BookmarkManagedObject.fetchRequest())) ?? [] diff --git a/DuckDuckGo/Bookmarks/Services/LocalBookmarkStore.swift b/DuckDuckGo/Bookmarks/Services/LocalBookmarkStore.swift index d8cdf7773f..b6b67dcacc 100644 --- a/DuckDuckGo/Bookmarks/Services/LocalBookmarkStore.swift +++ b/DuckDuckGo/Bookmarks/Services/LocalBookmarkStore.swift @@ -26,7 +26,6 @@ import Cocoa import Persistence import PixelKit -// swiftlint:disable:next type_body_length final class LocalBookmarkStore: BookmarkStore { convenience init(bookmarkDatabase: BookmarkDatabase) { @@ -685,7 +684,6 @@ final class LocalBookmarkStore: BookmarkStore { } } - // swiftlint:disable:next function_body_length func moveFavorites(with objectUUIDs: [String], toIndex index: Int?, completion: @escaping (Error?) -> Void) { applyChangesAndSave(changes: { [weak self] context in diff --git a/DuckDuckGo/Bookmarks/View/BookmarkListViewController.swift b/DuckDuckGo/Bookmarks/View/BookmarkListViewController.swift index d93ce96be6..44221d76e8 100644 --- a/DuckDuckGo/Bookmarks/View/BookmarkListViewController.swift +++ b/DuckDuckGo/Bookmarks/View/BookmarkListViewController.swift @@ -100,7 +100,7 @@ final class BookmarkListViewController: NSViewController { fatalError("\(type(of: self)): Bad initializer") } - override func loadView() { // swiftlint:disable:this function_body_length + override func loadView() { view = ColorView(frame: .zero, backgroundColor: .popoverBackground) view.addSubview(titleTextField) diff --git a/DuckDuckGo/Bookmarks/View/BookmarkManagementDetailViewController.swift b/DuckDuckGo/Bookmarks/View/BookmarkManagementDetailViewController.swift index 677a3ea6d7..a90b881d1e 100644 --- a/DuckDuckGo/Bookmarks/View/BookmarkManagementDetailViewController.swift +++ b/DuckDuckGo/Bookmarks/View/BookmarkManagementDetailViewController.swift @@ -72,7 +72,6 @@ final class BookmarkManagementDetailViewController: NSViewController, NSMenuItem fatalError("\(type(of: self)): Bad initializer") } - // swiftlint:disable:next function_body_length override func loadView() { view = ColorView(frame: .zero, backgroundColor: .bookmarkPageBackground) view.translatesAutoresizingMaskIntoConstraints = false diff --git a/DuckDuckGo/Common/Surveys/SurveyRemoteMessaging.swift b/DuckDuckGo/Common/Surveys/SurveyRemoteMessaging.swift index 50c2e5099b..19e46880ed 100644 --- a/DuckDuckGo/Common/Surveys/SurveyRemoteMessaging.swift +++ b/DuckDuckGo/Common/Surveys/SurveyRemoteMessaging.swift @@ -113,7 +113,7 @@ final class DefaultSurveyRemoteMessaging: SurveyRemoteMessaging { } } - // swiftlint:disable cyclomatic_complexity function_body_length + // swiftlint:disable cyclomatic_complexity /// Processes the messages received from S3 and returns those which the user is eligible for. This is done by checking each of the attributes against the user's local state. /// Because the result of the message fetch is cached, it means that they won't be immediately updated if the user suddenly qualifies, but the refresh interval for remote messages is only 1 hour so it @@ -239,7 +239,7 @@ final class DefaultSurveyRemoteMessaging: SurveyRemoteMessaging { } } - // swiftlint:enable cyclomatic_complexity function_body_length + // swiftlint:enable cyclomatic_complexity func presentableRemoteMessages() -> [SurveyRemoteMessage] { let dismissedMessageIDs = messageStorage.dismissedMessageIDs() diff --git a/DuckDuckGo/Common/Surveys/SurveyURLBuilder.swift b/DuckDuckGo/Common/Surveys/SurveyURLBuilder.swift index 380299afe4..9fa4754f2d 100644 --- a/DuckDuckGo/Common/Surveys/SurveyURLBuilder.swift +++ b/DuckDuckGo/Common/Surveys/SurveyURLBuilder.swift @@ -71,7 +71,7 @@ final class SurveyURLBuilder { self.daysSincePIRLastActive = daysSincePIRLastActive } - // swiftlint:disable:next cyclomatic_complexity function_body_length + // swiftlint:disable:next cyclomatic_complexity func buildSurveyURL(from originalURLString: String) -> URL? { guard var components = URLComponents(string: originalURLString) else { assertionFailure("Could not build components from survey URL") diff --git a/DuckDuckGo/DBP/DataBrokerProtectionDebugMenu.swift b/DuckDuckGo/DBP/DataBrokerProtectionDebugMenu.swift index 8abf7cf443..a01fa5dc20 100644 --- a/DuckDuckGo/DBP/DataBrokerProtectionDebugMenu.swift +++ b/DuckDuckGo/DBP/DataBrokerProtectionDebugMenu.swift @@ -52,7 +52,6 @@ final class DataBrokerProtectionDebugMenu: NSMenu { private let webUISettings = DataBrokerProtectionWebUIURLSettings(.dbp) private let settings = DataBrokerProtectionSettings(defaults: .dbp) - // swiftlint:disable:next function_body_length init() { super.init(title: "Personal Information Removal") diff --git a/DuckDuckGo/DBP/DataBrokerProtectionPixelsHandler.swift b/DuckDuckGo/DBP/DataBrokerProtectionPixelsHandler.swift index 5c257d71d4..de4b54b3ee 100644 --- a/DuckDuckGo/DBP/DataBrokerProtectionPixelsHandler.swift +++ b/DuckDuckGo/DBP/DataBrokerProtectionPixelsHandler.swift @@ -23,7 +23,6 @@ import Common public class DataBrokerProtectionPixelsHandler: EventMapping { - // swiftlint:disable:next function_body_length public init() { super.init { event, _, _, _ in switch event { diff --git a/DuckDuckGo/DataImport/Logins/CSV/CSVParser.swift b/DuckDuckGo/DataImport/Logins/CSV/CSVParser.swift index 5f2785a2d2..c912ddb7d4 100644 --- a/DuckDuckGo/DataImport/Logins/CSV/CSVParser.swift +++ b/DuckDuckGo/DataImport/Logins/CSV/CSVParser.swift @@ -67,7 +67,6 @@ struct CSVParser { hasPrecedingQuote = false } - // swiftlint:disable:next cyclomatic_complexity mutating func accept(_ character: Character) throws { switch (state, character.kind(delimiter: delimiter), precedingQuote: hasPrecedingQuote) { case (_, .unsupported, _): diff --git a/DuckDuckGo/DataImport/Model/DataImportViewModel.swift b/DuckDuckGo/DataImport/Model/DataImportViewModel.swift index 2e41fdbfd5..ceb2dd83e6 100644 --- a/DuckDuckGo/DataImport/Model/DataImportViewModel.swift +++ b/DuckDuckGo/DataImport/Model/DataImportViewModel.swift @@ -223,7 +223,7 @@ struct DataImportViewModel { /// Called with data import task result to update the state by merging the summary with an existing summary @MainActor - private mutating func mergeImportSummary(with summary: DataImportSummary) { // swiftlint:disable:this cyclomatic_complexity + private mutating func mergeImportSummary(with summary: DataImportSummary) { self.importTask = nil log("merging summary \(summary)") diff --git a/DuckDuckGo/DataImport/Model/InstructionsFormatParser.swift b/DuckDuckGo/DataImport/Model/InstructionsFormatParser.swift index 0f6fdbd576..3f68c7d66d 100644 --- a/DuckDuckGo/DataImport/Model/InstructionsFormatParser.swift +++ b/DuckDuckGo/DataImport/Model/InstructionsFormatParser.swift @@ -142,7 +142,6 @@ struct InstructionsFormatParser { currentEscapeSequence = "" } - // swiftlint:disable:next cyclomatic_complexity function_body_length mutating func accept(_ character: Character?) throws { switch (currentEscapeSequence, character) { // beggining of %-escaped seq diff --git a/DuckDuckGo/DataImport/ThirdPartyBrowser.swift b/DuckDuckGo/DataImport/ThirdPartyBrowser.swift index c749feeb1c..f32d88395f 100644 --- a/DuckDuckGo/DataImport/ThirdPartyBrowser.swift +++ b/DuckDuckGo/DataImport/ThirdPartyBrowser.swift @@ -49,7 +49,6 @@ enum ThirdPartyBrowser: CaseIterable { case onePassword7 case onePassword8 - // swiftlint:disable:next cyclomatic_complexity static func browser(for source: DataImport.Source) -> ThirdPartyBrowser? { switch source { case .brave: return .brave @@ -254,7 +253,6 @@ enum ThirdPartyBrowser: CaseIterable { } // Returns the URL to the profiles for a given browser. This directory will contain a list of directories, each representing a profile. - // swiftlint:disable:next cyclomatic_complexity func profilesDirectories(applicationSupportURL: URL? = nil) -> [URL] { let applicationSupportURL = applicationSupportURL ?? URL.nonSandboxApplicationSupportDirectoryURL return switch self { diff --git a/DuckDuckGo/DataImport/View/DataImportView.swift b/DuckDuckGo/DataImport/View/DataImportView.swift index b80609756f..ab880b0415 100644 --- a/DuckDuckGo/DataImport/View/DataImportView.swift +++ b/DuckDuckGo/DataImport/View/DataImportView.swift @@ -102,7 +102,6 @@ struct DataImportView: ModalView { } } - // swiftlint:disable:next cyclomatic_complexity private func viewBody() -> some View { VStack(alignment: .leading, spacing: 0) { // body @@ -452,7 +451,6 @@ extension DataImportViewModel { self.dataType = dataType } - // swiftlint:disable:next function_body_length func importData(types: Set) -> DataImportTask { .detachedWithProgress(.initial) { progressUpdate in func makeProgress(_ op: (Double) throws -> Void) async throws { diff --git a/DuckDuckGo/DataImport/View/FileImportView.swift b/DuckDuckGo/DataImport/View/FileImportView.swift index 8b70d513a0..ce0b45ad0e 100644 --- a/DuckDuckGo/DataImport/View/FileImportView.swift +++ b/DuckDuckGo/DataImport/View/FileImportView.swift @@ -20,7 +20,6 @@ import Common import SwiftUI import UniformTypeIdentifiers -// swiftlint:disable function_body_length cyclomatic_complexity @InstructionsView.InstructionsBuilder func fileImportInstructionsBuilder(source: DataImport.Source, dataType: DataImport.DataType, button: @escaping (String) -> AnyView) -> [InstructionsView.InstructionsItem] { @@ -452,7 +451,6 @@ func fileImportInstructionsBuilder(source: DataImport.Source, dataType: DataImpo assertionFailure("Invalid source/dataType") } } -// swiftlint:enable function_body_length cyclomatic_complexity struct FileImportView: View { @@ -592,7 +590,6 @@ struct InstructionsView: View { // View Model private let instructions: [[InstructionsViewItem]] - // swiftlint:disable:next function_body_length cyclomatic_complexity init(@InstructionsBuilder builder: () -> [InstructionsItem]) { var args = builder() diff --git a/DuckDuckGo/Email/EmailManagerRequestDelegate.swift b/DuckDuckGo/Email/EmailManagerRequestDelegate.swift index 43e96115fd..8a23b65a54 100644 --- a/DuckDuckGo/Email/EmailManagerRequestDelegate.swift +++ b/DuckDuckGo/Email/EmailManagerRequestDelegate.swift @@ -26,7 +26,6 @@ extension EmailManagerRequestDelegate { set {} } - // swiftlint:disable function_parameter_count func emailManager(_ emailManager: EmailManager, requested url: URL, method: String, headers: [String: String], parameters: [String: String]?, httpBody: Data?, timeoutInterval: TimeInterval) async throws -> Data { let finalURL = url.appendingParameters(parameters ?? [:]) var request = URLRequest(url: finalURL, timeoutInterval: timeoutInterval) @@ -45,7 +44,6 @@ extension EmailManagerRequestDelegate { return data } - // swiftlint:enable function_parameter_count public func emailManagerKeychainAccessFailed(_ emailManager: EmailManager, accessType: EmailKeychainAccessType, error: EmailKeychainAccessError) { var parameters = [ diff --git a/DuckDuckGo/FileDownload/View/DownloadsCellView.swift b/DuckDuckGo/FileDownload/View/DownloadsCellView.swift index 2c3f803924..89e5b1d722 100644 --- a/DuckDuckGo/FileDownload/View/DownloadsCellView.swift +++ b/DuckDuckGo/FileDownload/View/DownloadsCellView.swift @@ -108,7 +108,6 @@ final class DownloadsCellView: NSTableCellView { fatalError("\(Self.self): Bad initializer") } - // swiftlint:disable:next function_body_length private func setupUI() { self.imageView = fileIconView self.wantsLayer = true diff --git a/DuckDuckGo/FileDownload/View/DownloadsViewController.swift b/DuckDuckGo/FileDownload/View/DownloadsViewController.swift index 39d90bb666..85d8e2b4cb 100644 --- a/DuckDuckGo/FileDownload/View/DownloadsViewController.swift +++ b/DuckDuckGo/FileDownload/View/DownloadsViewController.swift @@ -52,7 +52,7 @@ final class DownloadsViewController: NSViewController { super.init(coder: coder) } - override func loadView() { // swiftlint:disable:this function_body_length + override func loadView() { view = NSView() view.addSubview(titleLabel) @@ -373,7 +373,6 @@ final class DownloadsViewController: NSViewController { extension DownloadsViewController: NSMenuDelegate { - // swiftlint:disable cyclomatic_complexity func menuNeedsUpdate(_ menu: NSMenu) { guard let index = index(for: menu), let item = viewModel.items[safe: index] @@ -412,8 +411,6 @@ extension DownloadsViewController: NSMenuDelegate { } } } - // swiftlint:enable cyclomatic_complexity - } extension DownloadsViewController: NSTableViewDataSource, NSTableViewDelegate { diff --git a/DuckDuckGo/History/Services/EncryptedHistoryStore.swift b/DuckDuckGo/History/Services/EncryptedHistoryStore.swift index a62dc501ce..2b5e9640d4 100644 --- a/DuckDuckGo/History/Services/EncryptedHistoryStore.swift +++ b/DuckDuckGo/History/Services/EncryptedHistoryStore.swift @@ -156,7 +156,6 @@ final class EncryptedHistoryStore: HistoryStoring { } } - // swiftlint:disable:next function_body_length 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/DuckDuckGo/HomePage/Model/HomePageRecentlyVisitedModel.swift b/DuckDuckGo/HomePage/Model/HomePageRecentlyVisitedModel.swift index a22162f63e..26b7d3faa4 100644 --- a/DuckDuckGo/HomePage/Model/HomePageRecentlyVisitedModel.swift +++ b/DuckDuckGo/HomePage/Model/HomePageRecentlyVisitedModel.swift @@ -284,7 +284,6 @@ final class RecentlyVisitedSiteModel: ObservableObject { return Self.feedImage(for: trackerNetwork) } - // swiftlint:disable:next cyclomatic_complexity static func feedImage(for trackerNetwork: TrackerNetwork) -> NSImage? { switch trackerNetwork { case .adform: .feedAdform diff --git a/DuckDuckGo/Menus/MainMenu.swift b/DuckDuckGo/Menus/MainMenu.swift index 7e281af02c..81ecfb047f 100644 --- a/DuckDuckGo/Menus/MainMenu.swift +++ b/DuckDuckGo/Menus/MainMenu.swift @@ -28,8 +28,8 @@ import NetworkProtection import Subscription import SubscriptionUI -// swiftlint:disable:next type_body_length -@MainActor final class MainMenu: NSMenu { +@MainActor +final class MainMenu: NSMenu { enum Constants { static let maxTitleLength = 55 @@ -553,7 +553,6 @@ import SubscriptionUI let internalUserItem = NSMenuItem(title: "Set Internal User State", action: #selector(MainViewController.internalUserState)) - // swiftlint:disable:next function_body_length private func setupDebugMenu() -> NSMenu { let debugMenu = NSMenu(title: "Debug") { NSMenuItem(title: "Open Vanilla Browser", action: #selector(MainViewController.openVanillaBrowser)).withAccessibilityIdentifier("MainMenu.openVanillaBrowser") diff --git a/DuckDuckGo/Menus/MainMenuActions.swift b/DuckDuckGo/Menus/MainMenuActions.swift index f69a9623e9..c959843b48 100644 --- a/DuckDuckGo/Menus/MainMenuActions.swift +++ b/DuckDuckGo/Menus/MainMenuActions.swift @@ -963,8 +963,6 @@ extension MainViewController { extension MainViewController: NSMenuItemValidation { - // swiftlint:disable cyclomatic_complexity - // swiftlint:disable function_body_length func validateMenuItem(_ menuItem: NSMenuItem) -> Bool { guard fireViewController.fireViewModel.fire.burningData == nil else { return true @@ -1068,9 +1066,6 @@ extension MainViewController: NSMenuItemValidation { return true } } - - // swiftlint:enable function_body_length - // swiftlint:enable cyclomatic_complexity } extension AppDelegate: NSMenuItemValidation { diff --git a/DuckDuckGo/NavigationBar/View/AddressBarButtonsViewController.swift b/DuckDuckGo/NavigationBar/View/AddressBarButtonsViewController.swift index 93b36547dc..318940ba35 100644 --- a/DuckDuckGo/NavigationBar/View/AddressBarButtonsViewController.swift +++ b/DuckDuckGo/NavigationBar/View/AddressBarButtonsViewController.swift @@ -29,7 +29,6 @@ protocol AddressBarButtonsViewControllerDelegate: AnyObject { } -// swiftlint:disable:next type_body_length final class AddressBarButtonsViewController: NSViewController { weak var delegate: AddressBarButtonsViewControllerDelegate? diff --git a/DuckDuckGo/NavigationBar/View/AddressBarTextField.swift b/DuckDuckGo/NavigationBar/View/AddressBarTextField.swift index 6acef850b7..eecba750f6 100644 --- a/DuckDuckGo/NavigationBar/View/AddressBarTextField.swift +++ b/DuckDuckGo/NavigationBar/View/AddressBarTextField.swift @@ -25,7 +25,6 @@ import PixelKit import Suggestions import Subscription -// swiftlint:disable:next type_body_length final class AddressBarTextField: NSTextField { var tabCollectionViewModel: TabCollectionViewModel! { diff --git a/DuckDuckGo/NavigationBar/View/NavigationBarViewController.swift b/DuckDuckGo/NavigationBar/View/NavigationBarViewController.swift index 85da78cd87..7f1b74a7df 100644 --- a/DuckDuckGo/NavigationBar/View/NavigationBarViewController.swift +++ b/DuckDuckGo/NavigationBar/View/NavigationBarViewController.swift @@ -28,7 +28,6 @@ import NetworkProtectionUI import Subscription import SubscriptionUI -// swiftlint:disable:next type_body_length final class NavigationBarViewController: NSViewController { enum Constants { diff --git a/DuckDuckGo/NavigationBar/ViewModel/PrivacyIconViewModel.swift b/DuckDuckGo/NavigationBar/ViewModel/PrivacyIconViewModel.swift index c588a5e843..74257c65ca 100644 --- a/DuckDuckGo/NavigationBar/ViewModel/PrivacyIconViewModel.swift +++ b/DuckDuckGo/NavigationBar/ViewModel/PrivacyIconViewModel.swift @@ -126,7 +126,6 @@ struct PrivacyIconViewModel { }()?.cgImage(forProposedRect: nil, context: .current, hints: nil) } - // swiftlint:disable cyclomatic_complexity private static func aquaLogo(for trackerNetwork: TrackerNetwork) -> NSImage? { switch trackerNetwork { case .adform: .adform @@ -216,8 +215,6 @@ struct PrivacyIconViewModel { case .xaxis: .xaxisDark } } - // swiftlint:enable cyclomatic_complexity - } extension Character { diff --git a/DuckDuckGo/NetworkProtection/AppTargets/BothAppTargets/NetworkProtectionDebugMenu.swift b/DuckDuckGo/NetworkProtection/AppTargets/BothAppTargets/NetworkProtectionDebugMenu.swift index 418ba71d9f..04464bd4f4 100644 --- a/DuckDuckGo/NetworkProtection/AppTargets/BothAppTargets/NetworkProtectionDebugMenu.swift +++ b/DuckDuckGo/NetworkProtection/AppTargets/BothAppTargets/NetworkProtectionDebugMenu.swift @@ -53,7 +53,6 @@ final class NetworkProtectionDebugMenu: NSMenu { private let excludeLocalNetworksMenuItem = NSMenuItem(title: "excludeLocalNetworks", action: #selector(NetworkProtectionDebugMenu.toggleShouldExcludeLocalRoutes)) - // swiftlint:disable:next function_body_length init() { preferredServerMenu = NSMenu { [preferredServerAutomaticItem] in preferredServerAutomaticItem diff --git a/DuckDuckGo/NetworkProtection/AppTargets/BothAppTargets/NetworkProtectionNavBarPopoverManager.swift b/DuckDuckGo/NetworkProtection/AppTargets/BothAppTargets/NetworkProtectionNavBarPopoverManager.swift index b2a029c814..6b55361611 100644 --- a/DuckDuckGo/NetworkProtection/AppTargets/BothAppTargets/NetworkProtectionNavBarPopoverManager.swift +++ b/DuckDuckGo/NetworkProtection/AppTargets/BothAppTargets/NetworkProtectionNavBarPopoverManager.swift @@ -59,7 +59,6 @@ final class NetworkProtectionNavBarPopoverManager: NetPPopoverManager { networkProtectionPopover?.isShown ?? false } - // swiftlint:disable:next function_body_length func show(positionedBelow view: NSView, withDelegate delegate: NSPopoverDelegate) -> NSPopover { let popover = { diff --git a/DuckDuckGo/NetworkProtection/AppTargets/BothAppTargets/NetworkProtectionTunnelController.swift b/DuckDuckGo/NetworkProtection/AppTargets/BothAppTargets/NetworkProtectionTunnelController.swift index 77143fc9ef..899897dfce 100644 --- a/DuckDuckGo/NetworkProtection/AppTargets/BothAppTargets/NetworkProtectionTunnelController.swift +++ b/DuckDuckGo/NetworkProtection/AppTargets/BothAppTargets/NetworkProtectionTunnelController.swift @@ -37,7 +37,6 @@ import Subscription typealias NetworkProtectionStatusChangeHandler = (NetworkProtection.ConnectionStatus) -> Void typealias NetworkProtectionConfigChangeHandler = () -> Void -// swiftlint:disable:next type_body_length final class NetworkProtectionTunnelController: TunnelController, TunnelSessionProvider { // MARK: - Settings diff --git a/DuckDuckGo/NetworkProtection/NetworkExtensionTargets/NetworkExtensionTargets/MacPacketTunnelProvider.swift b/DuckDuckGo/NetworkProtection/NetworkExtensionTargets/NetworkExtensionTargets/MacPacketTunnelProvider.swift index ac2fa676b9..6b31b50cb0 100644 --- a/DuckDuckGo/NetworkProtection/NetworkExtensionTargets/NetworkExtensionTargets/MacPacketTunnelProvider.swift +++ b/DuckDuckGo/NetworkProtection/NetworkExtensionTargets/NetworkExtensionTargets/MacPacketTunnelProvider.swift @@ -52,7 +52,6 @@ final class MacPacketTunnelProvider: PacketTunnelProvider { // MARK: - Error Reporting - // swiftlint:disable:next cyclomatic_complexity function_body_length private static func networkProtectionDebugEvents(controllerErrorStore: NetworkProtectionTunnelErrorStore) -> EventMapping? { return EventMapping { event, _, _, _ in let domainEvent: NetworkProtectionPixelEvent @@ -409,7 +408,6 @@ final class MacPacketTunnelProvider: PacketTunnelProvider { // MARK: - Initialization - // swiftlint:disable:next function_body_length @MainActor @objc public init() { #if NETP_SYSTEM_EXTENSION let defaults = UserDefaults.standard diff --git a/DuckDuckGo/PasswordManager/Bitwarden/Model/BWManager.swift b/DuckDuckGo/PasswordManager/Bitwarden/Model/BWManager.swift index f04f5f91a7..4cf474c0b9 100644 --- a/DuckDuckGo/PasswordManager/Bitwarden/Model/BWManager.swift +++ b/DuckDuckGo/PasswordManager/Bitwarden/Model/BWManager.swift @@ -276,8 +276,6 @@ final class BWManager: BWManagement, ObservableObject { sendStatus() } - // swiftlint:disable cyclomatic_complexity - // swiftlint:disable function_body_length private func handleEncryptedResponse(_ encryptedPayload: BWResponse.EncryptedPayload, messageId: MessageId) { guard let dataString = encryptedPayload.data, let data = Data(base64Encoded: dataString), @@ -339,8 +337,6 @@ final class BWManager: BWManagement, ObservableObject { logOrAssertionFailure("BWManager: Unhandled response") } - // swiftlint:enable cyclomatic_complexity - // swiftlint:enable function_body_length private func handleStatusResponse(payloadItemArray: [BWResponse.PayloadItem]) { // Find the active vault diff --git a/DuckDuckGo/PasswordManager/Bitwarden/View/ConnectBitwardenViewModel.swift b/DuckDuckGo/PasswordManager/Bitwarden/View/ConnectBitwardenViewModel.swift index be12ac247d..6c8eae636b 100644 --- a/DuckDuckGo/PasswordManager/Bitwarden/View/ConnectBitwardenViewModel.swift +++ b/DuckDuckGo/PasswordManager/Bitwarden/View/ConnectBitwardenViewModel.swift @@ -96,7 +96,6 @@ final class ConnectBitwardenViewModel: ObservableObject { } } - // swiftlint:disable cyclomatic_complexity func adjustViewState(status: BWStatus) { switch status { case .disabled: @@ -131,7 +130,6 @@ final class ConnectBitwardenViewModel: ObservableObject { self.error = error } } - // swiftlint:enable cyclomatic_complexity func process(action: ViewAction) { switch action { diff --git a/DuckDuckGo/Permissions/Model/PermissionState.swift b/DuckDuckGo/Permissions/Model/PermissionState.swift index 010e936979..fa789698d2 100644 --- a/DuckDuckGo/Permissions/Model/PermissionState.swift +++ b/DuckDuckGo/Permissions/Model/PermissionState.swift @@ -29,7 +29,6 @@ enum PermissionState: Equatable { case paused case inactive - // swiftlint:disable cyclomatic_complexity static func == (lhs: PermissionState, rhs: PermissionState) -> Bool { switch lhs { case .disabled(systemWide: let systemWide): if case .disabled(systemWide) = rhs { return true } @@ -43,7 +42,6 @@ enum PermissionState: Equatable { } return false } - // swiftlint:enable cyclomatic_complexity var isRequested: Bool { if case .requested = self { return true } diff --git a/DuckDuckGo/Preferences/Model/SyncPreferences.swift b/DuckDuckGo/Preferences/Model/SyncPreferences.swift index 84da490f1a..99a5416edd 100644 --- a/DuckDuckGo/Preferences/Model/SyncPreferences.swift +++ b/DuckDuckGo/Preferences/Model/SyncPreferences.swift @@ -210,7 +210,6 @@ final class SyncPreferences: ObservableObject, SyncUI.ManagementViewModel { invalidCredentialsTitles = invalidCredentialsObjects.map({ $0.truncated(length: 15) }) } - // swiftlint:disable:next function_body_length private func setUpObservables() { syncService.featureFlagsPublisher .dropFirst() diff --git a/DuckDuckGo/Preferences/View/PreferencesAutofillView.swift b/DuckDuckGo/Preferences/View/PreferencesAutofillView.swift index 1e05ba09f8..05c4235696 100644 --- a/DuckDuckGo/Preferences/View/PreferencesAutofillView.swift +++ b/DuckDuckGo/Preferences/View/PreferencesAutofillView.swift @@ -193,8 +193,6 @@ extension Preferences { .offset(x: PreferencesViews.Const.pickerHorizontalOffset) } - // swiftlint:disable cyclomatic_complexity - // swiftlint:disable function_body_length @ViewBuilder private func bitwardenStatusView(for status: BWStatus) -> some View { switch status { case .disabled: @@ -277,8 +275,6 @@ extension Preferences { .offset(x: Preferences.Const.autoLockWarningOffset) } } - // swiftlint:enable cyclomatic_complexity - // swiftlint:enable function_body_length } } diff --git a/DuckDuckGo/Preferences/View/PreferencesRootView.swift b/DuckDuckGo/Preferences/View/PreferencesRootView.swift index 4658eb92b5..2c53e1dd64 100644 --- a/DuckDuckGo/Preferences/View/PreferencesRootView.swift +++ b/DuckDuckGo/Preferences/View/PreferencesRootView.swift @@ -123,7 +123,6 @@ enum Preferences { .padding(.horizontal, Const.panePaddingHorizontal) } - // swiftlint:disable:next cyclomatic_complexity function_body_length private func makeSubscriptionViewModel() -> PreferencesSubscriptionModel { let openURL: (URL) -> Void = { url in DispatchQueue.main.async { diff --git a/DuckDuckGo/RemoteMessaging/RemoteMessagingConfigMatcherProvider.swift b/DuckDuckGo/RemoteMessaging/RemoteMessagingConfigMatcherProvider.swift index 1c5ff18e8a..5749f42f65 100644 --- a/DuckDuckGo/RemoteMessaging/RemoteMessagingConfigMatcherProvider.swift +++ b/DuckDuckGo/RemoteMessaging/RemoteMessagingConfigMatcherProvider.swift @@ -48,7 +48,6 @@ final class RemoteMessagingConfigMatcherProvider: RemoteMessagingConfigMatcherPr let statisticsStore: StatisticsStore let variantManager: VariantManager - // swiftlint:disable:next function_body_length func refreshConfigMatcher(using store: RemoteMessagingStoring) async -> RemoteMessagingConfigMatcher { var bookmarksCount = 0 diff --git a/DuckDuckGo/SecureVault/View/PasswordManagementViewController.swift b/DuckDuckGo/SecureVault/View/PasswordManagementViewController.swift index 098120fa5f..c3a0b0fe7d 100644 --- a/DuckDuckGo/SecureVault/View/PasswordManagementViewController.swift +++ b/DuckDuckGo/SecureVault/View/PasswordManagementViewController.swift @@ -33,7 +33,6 @@ protocol PasswordManagementDelegate: AnyObject { } -// swiftlint:disable:next type_body_length final class PasswordManagementViewController: NSViewController { static func create() -> Self { @@ -725,8 +724,6 @@ final class PasswordManagementViewController: NSViewController { var passwordManagerSelectionCancellable: AnyCancellable? - // swiftlint:disable function_body_length - // swiftlint:disable:next cyclomatic_complexity private func createListView() { let listModel = PasswordManagementItemListModel(passwordManagerCoordinator: self.passwordManagerCoordinator, onItemSelected: { [weak self] previousValue, newValue in guard let newValue = newValue, @@ -821,8 +818,6 @@ final class PasswordManagementViewController: NSViewController { replaceItemContainerChildView(with: view) } - // swiftlint:enable function_body_length - private func createNewSecureVaultItemMenu() -> NSMenu { return NSMenu { NSMenuItem(title: UserText.pmNewLogin, action: #selector(createNewLogin), target: self).withImage(.loginGlyph) diff --git a/DuckDuckGo/StateRestoration/Tab+NSSecureCoding.swift b/DuckDuckGo/StateRestoration/Tab+NSSecureCoding.swift index e1a92c5908..f70a5eefcb 100644 --- a/DuckDuckGo/StateRestoration/Tab+NSSecureCoding.swift +++ b/DuckDuckGo/StateRestoration/Tab+NSSecureCoding.swift @@ -97,7 +97,6 @@ private extension Tab.TabContent { case onboarding = 9 } - // swiftlint:disable:next cyclomatic_complexity init?(type: ContentType, url: URL?, videoID: String?, timestamp: String?, preferencePane: PreferencePaneIdentifier?) { switch type { case .newtab: diff --git a/DuckDuckGo/Statistics/GeneralPixel.swift b/DuckDuckGo/Statistics/GeneralPixel.swift index fb829b23c7..c364e8a99d 100644 --- a/DuckDuckGo/Statistics/GeneralPixel.swift +++ b/DuckDuckGo/Statistics/GeneralPixel.swift @@ -22,8 +22,6 @@ import BrowserServicesKit import DDGSync import Configuration -// swiftlint:disable file_length -// swiftlint:disable:next type_body_length enum GeneralPixel: PixelKitEventV2 { case crash @@ -1201,4 +1199,3 @@ enum GeneralPixel: PixelKitEventV2 { } } -// swiftlint:enable file_length diff --git a/DuckDuckGo/Sync/SyncErrorHandler.swift b/DuckDuckGo/Sync/SyncErrorHandler.swift index 7edeec8d6b..bb73ba5dcc 100644 --- a/DuckDuckGo/Sync/SyncErrorHandler.swift +++ b/DuckDuckGo/Sync/SyncErrorHandler.swift @@ -256,7 +256,6 @@ extension SyncErrorHandler: SyncErrorHandling { } } - // swiftlint:disable:next cyclomatic_complexity private func handleSyncError(_ syncError: SyncError, modelType: ModelType) { switch syncError { case .unexpectedStatusCode(409): @@ -331,7 +330,6 @@ extension SyncErrorHandler: SyncErrorHandling { } } - // swiftlint:disable:next cyclomatic_complexity private func showSyncPausedAlertIfNeeded(for errorType: AsyncErrorType) { switch errorType { case .bookmarksCountLimitExceeded, .bookmarksRequestSizeLimitExceeded: diff --git a/DuckDuckGo/Tab/Model/Tab.swift b/DuckDuckGo/Tab/Model/Tab.swift index 0b2fd3fa8c..99e6598883 100644 --- a/DuckDuckGo/Tab/Model/Tab.swift +++ b/DuckDuckGo/Tab/Model/Tab.swift @@ -26,8 +26,6 @@ import WebKit import History import PixelKit -// swiftlint:disable file_length - protocol TabDelegate: ContentOverlayUserScriptDelegate { func tabWillStartNavigation(_ tab: Tab, isUserInitiated: Bool) func tabDidStartNavigation(_ tab: Tab) @@ -41,7 +39,6 @@ protocol NewWindowPolicyDecisionMaker { func decideNewWindowPolicy(for navigationAction: WKNavigationAction) -> NavigationDecision? } -// swiftlint:disable:next type_body_length @dynamicMemberLookup final class Tab: NSObject, Identifiable, ObservableObject { private struct ExtensionDependencies: TabExtensionDependencies { @@ -157,7 +154,6 @@ protocol NewWindowPolicyDecisionMaker { } @MainActor - // swiftlint:disable:next function_body_length init(content: TabContent, faviconManagement: FaviconManagement, webCacheManager: WebCacheManager, @@ -1258,5 +1254,3 @@ extension Tab { } } - -// swiftlint:enable file_length diff --git a/DuckDuckGo/Tab/Model/TabContent.swift b/DuckDuckGo/Tab/Model/TabContent.swift index f8669a06cb..91dc3f64f8 100644 --- a/DuckDuckGo/Tab/Model/TabContent.swift +++ b/DuckDuckGo/Tab/Model/TabContent.swift @@ -96,7 +96,6 @@ extension TabContent { } extension TabContent { - // swiftlint:disable:next cyclomatic_complexity static func contentFromURL(_ url: URL?, source: URLSource) -> TabContent { switch url { case URL.newtab, URL.Invalid.aboutNewtab, URL.Invalid.duckHome: diff --git a/DuckDuckGo/Tab/Navigation/ExternalAppSchemeHandler.swift b/DuckDuckGo/Tab/Navigation/ExternalAppSchemeHandler.swift index 75fdbbea30..914b4b863b 100644 --- a/DuckDuckGo/Tab/Navigation/ExternalAppSchemeHandler.swift +++ b/DuckDuckGo/Tab/Navigation/ExternalAppSchemeHandler.swift @@ -53,7 +53,6 @@ final class ExternalAppSchemeHandler { extension ExternalAppSchemeHandler: NavigationResponder { - // swiftlint:disable:next function_body_length @MainActor func decidePolicy(for navigationAction: NavigationAction, preferences: inout NavigationPreferences) async -> NavigationActionPolicy? { let externalUrl = navigationAction.url // only proceed with non-external-scheme navigations diff --git a/DuckDuckGo/Tab/TabExtensions/TabExtensions.swift b/DuckDuckGo/Tab/TabExtensions/TabExtensions.swift index 0bc8df6bab..a29bf00cbb 100644 --- a/DuckDuckGo/Tab/TabExtensions/TabExtensions.swift +++ b/DuckDuckGo/Tab/TabExtensions/TabExtensions.swift @@ -89,7 +89,6 @@ typealias TabExtensionsBuilderArguments = ( webViewFuture: Future ) -// swiftlint:disable function_body_length extension TabExtensionsBuilder { /// Instantiate `TabExtension`-s for App builds here @@ -213,7 +212,6 @@ extension TabExtensionsBuilder { } } -// swiftlint:enable function_body_length #if DEBUG extension TestTabExtensionsBuilder { diff --git a/DuckDuckGo/Tab/UserScripts/Subscription/SubscriptionErrorReporter.swift b/DuckDuckGo/Tab/UserScripts/Subscription/SubscriptionErrorReporter.swift index 27a88fec6a..0058cebd4f 100644 --- a/DuckDuckGo/Tab/UserScripts/Subscription/SubscriptionErrorReporter.swift +++ b/DuckDuckGo/Tab/UserScripts/Subscription/SubscriptionErrorReporter.swift @@ -43,7 +43,6 @@ protocol SubscriptionErrorReporter { struct DefaultSubscriptionErrorReporter: SubscriptionErrorReporter { - // swiftlint:disable:next cyclomatic_complexity func report(subscriptionActivationError: SubscriptionError) { os_log(.error, log: .subscription, "Subscription purchase error: %{public}s", subscriptionActivationError.localizedDescription) diff --git a/DuckDuckGo/Tab/UserScripts/Subscription/SubscriptionPagesUseSubscriptionFeature.swift b/DuckDuckGo/Tab/UserScripts/Subscription/SubscriptionPagesUseSubscriptionFeature.swift index 812e03026b..ad14f0ac86 100644 --- a/DuckDuckGo/Tab/UserScripts/Subscription/SubscriptionPagesUseSubscriptionFeature.swift +++ b/DuckDuckGo/Tab/UserScripts/Subscription/SubscriptionPagesUseSubscriptionFeature.swift @@ -74,7 +74,6 @@ final class SubscriptionPagesUseSubscriptionFeature: Subfeature { static let getAccessToken = "getAccessToken" } - // swiftlint:disable:next cyclomatic_complexity func handler(forMethodNamed methodName: String) -> Subfeature.Handler? { switch methodName { case Handlers.getSubscription: return getSubscription @@ -166,7 +165,6 @@ final class SubscriptionPagesUseSubscriptionFeature: Subfeature { return SubscriptionOptions.empty } - // swiftlint:disable:next function_body_length cyclomatic_complexity func subscriptionSelected(params: Any, original: WKScriptMessage) async throws -> Encodable? { PixelKit.fire(PrivacyProPixel.privacyProPurchaseAttempt, frequency: .dailyAndCount) struct SubscriptionSelection: Decodable { diff --git a/DuckDuckGo/Tab/UserScripts/UserScripts.swift b/DuckDuckGo/Tab/UserScripts/UserScripts.swift index 664c08c210..824883ff54 100644 --- a/DuckDuckGo/Tab/UserScripts/UserScripts.swift +++ b/DuckDuckGo/Tab/UserScripts/UserScripts.swift @@ -47,7 +47,6 @@ final class UserScripts: UserScriptsProvider { let sslErrorPageUserScript: SSLErrorPageUserScript? let onboardingUserScript: OnboardingUserScript? - // swiftlint:disable:next function_body_length init(with sourceProvider: ScriptSourceProviding) { clickToLoadScript = ClickToLoadUserScript() contentBlockerRulesScript = ContentBlockerRulesUserScript(configuration: sourceProvider.contentBlockerRulesConfig!) diff --git a/DuckDuckGo/Tab/View/BrowserTabViewController.swift b/DuckDuckGo/Tab/View/BrowserTabViewController.swift index 97ca779da0..af82388418 100644 --- a/DuckDuckGo/Tab/View/BrowserTabViewController.swift +++ b/DuckDuckGo/Tab/View/BrowserTabViewController.swift @@ -25,8 +25,6 @@ import WebKit import Subscription import PixelKit -// swiftlint:disable file_length -// swiftlint:disable:next type_body_length final class BrowserTabViewController: NSViewController { private lazy var browserTabView = BrowserTabView(frame: .zero, backgroundColor: .browserTabBackground) @@ -1270,5 +1268,3 @@ extension BrowserTabViewController { #Preview { BrowserTabViewController(tabCollectionViewModel: TabCollectionViewModel(tabCollection: TabCollection(tabs: [.init(content: .url(.duckDuckGo, source: .ui))]))) } - -// swiftlint:enable file_length diff --git a/DuckDuckGo/Tab/ViewModel/TabViewModel.swift b/DuckDuckGo/Tab/ViewModel/TabViewModel.swift index 58bcaaa153..3d9a822688 100644 --- a/DuckDuckGo/Tab/ViewModel/TabViewModel.swift +++ b/DuckDuckGo/Tab/ViewModel/TabViewModel.swift @@ -345,7 +345,7 @@ final class TabViewModel { } } - private func updateTitle() { // swiftlint:disable:this cyclomatic_complexity + private func updateTitle() { var title: String switch tab.content { // keep an old tab title for web page terminated page, display "Failed to open page" for loading errors @@ -388,7 +388,6 @@ final class TabViewModel { } } - // swiftlint:disable:next cyclomatic_complexity private func updateFavicon(_ tabFavicon: NSImage?? = .none /* provided from .sink or taken from tab.favicon (optional) if .none */) { guard !isShowingErrorPage else { favicon = errorFaviconToShow(error: tab.error) diff --git a/DuckDuckGo/TabBar/View/TabBarViewController.swift b/DuckDuckGo/TabBar/View/TabBarViewController.swift index f9c10c5e34..58021902f5 100644 --- a/DuckDuckGo/TabBar/View/TabBarViewController.swift +++ b/DuckDuckGo/TabBar/View/TabBarViewController.swift @@ -23,8 +23,6 @@ import Lottie import SwiftUI import WebKit -// swiftlint:disable file_length - final class TabBarViewController: NSViewController { enum HorizontalSpace: CGFloat { @@ -1249,5 +1247,3 @@ final class TabBarViewItemPasteboardWriter: NSObject, NSPasteboardWriting { } } - -// swiftlint:enable file_length diff --git a/DuckDuckGo/TabBar/ViewModel/TabCollectionViewModel.swift b/DuckDuckGo/TabBar/ViewModel/TabCollectionViewModel.swift index c4bb6b716b..68dc3ee7a4 100644 --- a/DuckDuckGo/TabBar/ViewModel/TabCollectionViewModel.swift +++ b/DuckDuckGo/TabBar/ViewModel/TabCollectionViewModel.swift @@ -39,7 +39,6 @@ protocol TabCollectionViewModelDelegate: AnyObject { } @MainActor -// swiftlint:disable:next type_body_length final class TabCollectionViewModel: NSObject { weak var delegate: TabCollectionViewModelDelegate? diff --git a/DuckDuckGo/YoutubePlayer/DuckPlayer.swift b/DuckDuckGo/YoutubePlayer/DuckPlayer.swift index ba7e32dcc5..8481318e0e 100644 --- a/DuckDuckGo/YoutubePlayer/DuckPlayer.swift +++ b/DuckDuckGo/YoutubePlayer/DuckPlayer.swift @@ -141,7 +141,6 @@ final class DuckPlayer { // MARK: - Common Message Handlers - // swiftlint:disable:next cyclomatic_complexity public func handleSetUserValuesMessage( from origin: YoutubeOverlayUserScript.MessageOrigin ) -> (_ params: Any, _ message: UserScriptMessage) -> Encodable? { diff --git a/Gemfile b/Gemfile index 08d3071c2b..67bb0aed9f 100644 --- a/Gemfile +++ b/Gemfile @@ -1,4 +1,4 @@ source 'https://rubygems.org' gem 'fastlane', '2.217.0' -gem 'httparty' +gem 'httparty' \ No newline at end of file diff --git a/Gemfile.lock b/Gemfile.lock index 494e999a3b..27aeb2730b 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,41 +1,46 @@ GEM remote: https://rubygems.org/ specs: - CFPropertyList (3.0.6) + CFPropertyList (3.0.7) + base64 + nkf rexml - addressable (2.8.5) - public_suffix (>= 2.0.2, < 6.0) - artifactory (3.0.15) + addressable (2.8.7) + public_suffix (>= 2.0.2, < 7.0) + artifactory (3.0.17) atomos (0.1.3) - aws-eventstream (1.2.0) - aws-partitions (1.850.0) - aws-sdk-core (3.186.0) - aws-eventstream (~> 1, >= 1.0.2) + aws-eventstream (1.3.0) + aws-partitions (1.953.0) + aws-sdk-core (3.201.1) + aws-eventstream (~> 1, >= 1.3.0) aws-partitions (~> 1, >= 1.651.0) - aws-sigv4 (~> 1.5) + aws-sigv4 (~> 1.8) jmespath (~> 1, >= 1.6.1) - aws-sdk-kms (1.72.0) - aws-sdk-core (~> 3, >= 3.184.0) - aws-sigv4 (~> 1.1) - aws-sdk-s3 (1.136.0) - aws-sdk-core (~> 3, >= 3.181.0) + aws-sdk-kms (1.88.0) + aws-sdk-core (~> 3, >= 3.201.0) + aws-sigv4 (~> 1.5) + aws-sdk-s3 (1.156.0) + aws-sdk-core (~> 3, >= 3.201.0) aws-sdk-kms (~> 1) - aws-sigv4 (~> 1.6) - aws-sigv4 (1.6.1) + aws-sigv4 (~> 1.5) + aws-sigv4 (1.8.0) aws-eventstream (~> 1, >= 1.0.2) babosa (1.0.4) + base64 (0.2.0) + bigdecimal (3.1.8) claide (1.1.0) colored (1.2) colored2 (3.1.2) commander (4.6.0) highline (~> 2.0.0) + csv (3.3.0) declarative (0.0.20) digest-crc (0.6.5) rake (>= 12.0.0, < 14.0.0) - domain_name (0.6.20231109) + domain_name (0.6.20240107) dotenv (2.8.1) emoji_regex (3.2.3) - excon (0.104.0) + excon (0.111.0) faraday (1.10.3) faraday-em_http (~> 1.0) faraday-em_synchrony (~> 1.0) @@ -64,7 +69,7 @@ GEM faraday-retry (1.0.3) faraday_middleware (1.2.0) faraday (~> 1.0) - fastimage (2.2.7) + fastimage (2.3.1) fastlane (2.217.0) CFPropertyList (>= 2.3, < 4.0.0) addressable (>= 2.8, < 3.0.0) @@ -106,76 +111,82 @@ GEM xcpretty (~> 0.3.0) xcpretty-travis-formatter (>= 0.0.3) gh_inspector (1.1.3) - google-apis-androidpublisher_v3 (0.52.0) - google-apis-core (>= 0.11.0, < 2.a) - google-apis-core (0.11.2) + google-apis-androidpublisher_v3 (0.66.0) + google-apis-core (>= 0.15.0, < 2.a) + google-apis-core (0.15.0) addressable (~> 2.5, >= 2.5.1) - googleauth (>= 0.16.2, < 2.a) + googleauth (~> 1.9) httpclient (>= 2.8.1, < 3.a) mini_mime (~> 1.0) representable (~> 3.0) retriable (>= 2.0, < 4.a) rexml - webrick - google-apis-iamcredentials_v1 (0.17.0) - google-apis-core (>= 0.11.0, < 2.a) - google-apis-playcustomapp_v1 (0.13.0) - google-apis-core (>= 0.11.0, < 2.a) - google-apis-storage_v1 (0.29.0) - google-apis-core (>= 0.11.0, < 2.a) - google-cloud-core (1.6.0) - google-cloud-env (~> 1.0) + google-apis-iamcredentials_v1 (0.21.0) + google-apis-core (>= 0.15.0, < 2.a) + google-apis-playcustomapp_v1 (0.16.0) + google-apis-core (>= 0.15.0, < 2.a) + google-apis-storage_v1 (0.40.0) + google-apis-core (>= 0.15.0, < 2.a) + google-cloud-core (1.7.0) + google-cloud-env (>= 1.0, < 3.a) google-cloud-errors (~> 1.0) - google-cloud-env (1.6.0) - faraday (>= 0.17.3, < 3.0) - google-cloud-errors (1.3.1) - google-cloud-storage (1.45.0) + google-cloud-env (2.1.1) + faraday (>= 1.0, < 3.a) + google-cloud-errors (1.4.0) + google-cloud-storage (1.52.0) addressable (~> 2.8) digest-crc (~> 0.4) - google-apis-iamcredentials_v1 (~> 0.1) - google-apis-storage_v1 (~> 0.29.0) + google-apis-core (~> 0.13) + google-apis-iamcredentials_v1 (~> 0.18) + google-apis-storage_v1 (~> 0.38) google-cloud-core (~> 1.6) - googleauth (>= 0.16.2, < 2.a) + googleauth (~> 1.9) mini_mime (~> 1.0) - googleauth (1.8.1) - faraday (>= 0.17.3, < 3.a) + googleauth (1.11.0) + faraday (>= 1.0, < 3.a) + google-cloud-env (~> 2.1) jwt (>= 1.4, < 3.0) multi_json (~> 1.11) os (>= 0.9, < 2.0) signet (>= 0.16, < 2.a) highline (2.0.3) - http-cookie (1.0.5) + http-cookie (1.0.6) domain_name (~> 0.5) - httparty (0.21.0) + httparty (0.22.0) + csv mini_mime (>= 1.0.0) multi_xml (>= 0.5.2) httpclient (2.8.3) jmespath (1.6.2) - json (2.6.3) - jwt (2.7.1) - mini_magick (4.12.0) + json (2.7.2) + jwt (2.8.2) + base64 + mini_magick (4.13.2) mini_mime (1.1.5) multi_json (1.15.0) - multi_xml (0.6.0) - multipart-post (2.3.0) + multi_xml (0.7.1) + bigdecimal (~> 3.1) + multipart-post (2.4.1) nanaimo (0.3.0) naturally (2.2.1) + nkf (0.2.0) optparse (0.1.1) os (1.1.4) - plist (3.7.0) - public_suffix (5.0.3) - rake (13.1.0) + plist (3.7.1) + public_suffix (6.0.0) + rake (13.2.1) representable (3.2.0) declarative (< 0.1.0) trailblazer-option (>= 0.1.1, < 0.2.0) uber (< 0.2.0) retriable (3.1.2) - rexml (3.2.6) + rexml (3.2.9) + strscan rouge (2.0.7) ruby2_keywords (0.0.5) rubyzip (2.3.2) security (0.1.3) - signet (0.18.0) + signet (0.19.0) addressable (~> 2.8) faraday (>= 0.17.5, < 3.a) jwt (>= 1.5, < 3.0) @@ -183,19 +194,19 @@ GEM simctl (1.6.10) CFPropertyList naturally + strscan (3.1.0) terminal-notifier (2.0.0) terminal-table (3.0.2) unicode-display_width (>= 1.1.1, < 3) trailblazer-option (0.1.2) tty-cursor (0.7.1) - tty-screen (0.8.1) + tty-screen (0.8.2) tty-spinner (0.9.3) tty-cursor (~> 0.7) uber (0.1.0) unicode-display_width (2.5.0) - webrick (1.8.1) word_wrap (1.0.0) - xcodeproj (1.23.0) + xcodeproj (1.24.0) CFPropertyList (>= 2.3.3, < 4.0) atomos (~> 0.1.3) claide (>= 1.0.2, < 2.0) diff --git a/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Model/CCFRequestParameters.swift b/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Model/CCFRequestParameters.swift index ff30e4f541..f2fdbc9c24 100644 --- a/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Model/CCFRequestParameters.swift +++ b/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Model/CCFRequestParameters.swift @@ -46,7 +46,6 @@ struct ActionRequest: Encodable { case data } - // swiftlint:disable:next cyclomatic_complexity func encode(to encoder: Encoder) throws { var container = encoder.container(keyedBy: CodingKeys.self) diff --git a/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Operations/DataBrokerJob.swift b/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Operations/DataBrokerJob.swift index b5c94350ec..98fd68607a 100644 --- a/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Operations/DataBrokerJob.swift +++ b/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Operations/DataBrokerJob.swift @@ -71,7 +71,6 @@ extension DataBrokerJob { // MARK: - Shared functions - // swiftlint:disable:next cyclomatic_complexity func runNextAction(_ action: Action) async { switch action { case is GetCaptchaInfoAction: diff --git a/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Operations/DataBrokerProfileQueryOperationManager.swift b/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Operations/DataBrokerProfileQueryOperationManager.swift index 86ce808de0..d3c670768d 100644 --- a/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Operations/DataBrokerProfileQueryOperationManager.swift +++ b/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Operations/DataBrokerProfileQueryOperationManager.swift @@ -100,7 +100,7 @@ struct DataBrokerProfileQueryOperationManager: OperationsManager { } } - // swiftlint:disable:next cyclomatic_complexity function_body_length + // swiftlint:disable:next cyclomatic_complexity internal func runScanOperation(on runner: WebJobRunner, brokerProfileQueryData: BrokerProfileQueryData, database: DataBrokerProtectionRepository, @@ -268,7 +268,6 @@ struct DataBrokerProfileQueryOperationManager: OperationsManager { } } - // swiftlint:disable:next function_body_length internal func runOptOutOperation(for extractedProfile: ExtractedProfile, on runner: WebJobRunner, brokerProfileQueryData: BrokerProfileQueryData, diff --git a/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Pixels/DataBrokerProtectionPixels.swift b/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Pixels/DataBrokerProtectionPixels.swift index 7dd01f0e3a..b57f7dc2d3 100644 --- a/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Pixels/DataBrokerProtectionPixels.swift +++ b/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Pixels/DataBrokerProtectionPixels.swift @@ -473,7 +473,6 @@ extension DataBrokerProtectionPixels: PixelKitEvent { public class DataBrokerProtectionPixelsHandler: EventMapping { - // swiftlint:disable:next function_body_length public init() { super.init { event, _, _, _ in switch event { diff --git a/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Scheduler/DataBrokerProtectionAgentManager.swift b/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Scheduler/DataBrokerProtectionAgentManager.swift index aada01d0c3..81dbcaed47 100644 --- a/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Scheduler/DataBrokerProtectionAgentManager.swift +++ b/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Scheduler/DataBrokerProtectionAgentManager.swift @@ -23,7 +23,7 @@ import PixelKit // This is to avoid exposing all the dependancies outside of the DBP package public class DataBrokerProtectionAgentManagerProvider { - // swiftlint:disable:next function_body_length + public static func agentManager(authenticationManager: DataBrokerProtectionAuthenticationManaging) -> DataBrokerProtectionAgentManager { let pixelHandler = DataBrokerProtectionPixelsHandler() diff --git a/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Storage/DataBrokerProtectionDatabaseProvider.swift b/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Storage/DataBrokerProtectionDatabaseProvider.swift index d346a51917..c00a7af63d 100644 --- a/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Storage/DataBrokerProtectionDatabaseProvider.swift +++ b/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Storage/DataBrokerProtectionDatabaseProvider.swift @@ -90,7 +90,6 @@ final class DefaultDataBrokerProtectionDatabaseProvider: GRDBSecureStorageDataba } } - // swiftlint:disable function_body_length static func migrateV1(database: Database) throws { // User profile try database.create(table: ProfileDB.databaseTableName) { @@ -271,8 +270,6 @@ final class DefaultDataBrokerProtectionDatabaseProvider: GRDBSecureStorageDataba """) } - // swiftlint:enable function_body_length - func updateProfile(profile: DataBrokerProtectionProfile, mapperToDB: MapperToDB) throws -> Int64 { try db.write { db in diff --git a/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/UI/DBPUICommunicationLayer.swift b/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/UI/DBPUICommunicationLayer.swift index a5a2b4df07..3df461b1ed 100644 --- a/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/UI/DBPUICommunicationLayer.swift +++ b/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/UI/DBPUICommunicationLayer.swift @@ -83,7 +83,6 @@ struct DBPUICommunicationLayer: Subfeature { ]) } - // swiftlint:disable:next cyclomatic_complexity func handler(forMethodNamed methodName: String) -> Handler? { guard let actionResult = DBPUIReceivedMethodName(rawValue: methodName) else { os_log("Cant parse method: %{public}@", log: .dataBrokerProtection, methodName) diff --git a/LocalPackages/DataBrokerProtection/Tests/DataBrokerProtectionTests/BrokerJSONCodableTests.swift b/LocalPackages/DataBrokerProtection/Tests/DataBrokerProtectionTests/BrokerJSONCodableTests.swift index 7f77811b1c..e7ccb81606 100644 --- a/LocalPackages/DataBrokerProtection/Tests/DataBrokerProtectionTests/BrokerJSONCodableTests.swift +++ b/LocalPackages/DataBrokerProtection/Tests/DataBrokerProtectionTests/BrokerJSONCodableTests.swift @@ -360,7 +360,6 @@ final class BrokerJSONCodableTests: XCTestCase { } } - // swiftlint:disable function_body_length func testParentSelector_isCorrectlyParsed() { let json = """ { @@ -432,5 +431,4 @@ final class BrokerJSONCodableTests: XCTestCase { XCTFail("JSON string should be parsed correctly.") } } - // swiftlint:enable function_body_length } diff --git a/LocalPackages/DataBrokerProtection/Tests/DataBrokerProtectionTests/DataBrokerProfileQueryOperationManagerTests.swift b/LocalPackages/DataBrokerProtection/Tests/DataBrokerProtectionTests/DataBrokerProfileQueryOperationManagerTests.swift index dddfc05f96..b55844c660 100644 --- a/LocalPackages/DataBrokerProtection/Tests/DataBrokerProtectionTests/DataBrokerProfileQueryOperationManagerTests.swift +++ b/LocalPackages/DataBrokerProtection/Tests/DataBrokerProtectionTests/DataBrokerProfileQueryOperationManagerTests.swift @@ -16,8 +16,6 @@ // limitations under the License. // -// swiftlint:disable type_body_length - import XCTest import BrowserServicesKit import Common @@ -1088,5 +1086,3 @@ extension AttemptInformation { startDate: Date()) } } - -// swiftlint:enable type_body_length diff --git a/LocalPackages/UDSHelper/Sources/UDSHelper/UDSReceiver.swift b/LocalPackages/UDSHelper/Sources/UDSHelper/UDSReceiver.swift index 8d82a4ecdb..90e55c25dd 100644 --- a/LocalPackages/UDSHelper/Sources/UDSHelper/UDSReceiver.swift +++ b/LocalPackages/UDSHelper/Sources/UDSHelper/UDSReceiver.swift @@ -54,7 +54,6 @@ struct UDSReceiver { } } - // swiftlint:disable:next cyclomatic_complexity private func runReceiveMessageLoop(on connection: NWConnection, messageHandler: @escaping MessageHandler, onError errorHandler: @escaping (Error) async -> Bool) async { while true { diff --git a/UnitTests/DataImport/DataImportViewModelTests.swift b/UnitTests/DataImport/DataImportViewModelTests.swift index 31ac01269b..da347bbebd 100644 --- a/UnitTests/DataImport/DataImportViewModelTests.swift +++ b/UnitTests/DataImport/DataImportViewModelTests.swift @@ -21,7 +21,6 @@ import Foundation import XCTest @testable import DuckDuckGo_Privacy_Browser -// swiftlint:disable:next type_body_length @MainActor final class DataImportViewModelTests: XCTestCase { typealias Source = DataImport.Source diff --git a/UnitTests/Tab/Services/FaviconManagerMock.swift b/UnitTests/Tab/Services/FaviconManagerMock.swift index 12725210f2..b41464611a 100644 --- a/UnitTests/Tab/Services/FaviconManagerMock.swift +++ b/UnitTests/Tab/Services/FaviconManagerMock.swift @@ -53,7 +53,6 @@ final class FaviconManagerMock: FaviconManagement { completion() } - // swiftlint:disable:next function_parameter_count func burnDomains(_ domains: Set, exceptBookmarks bookmarkManager: any DuckDuckGo_Privacy_Browser.BookmarkManager, exceptSavedLogins: Set, exceptExistingHistory history: History.BrowsingHistory, tld: Common.TLD, completion: @escaping @MainActor () -> Void) { completion() }