From 751f90ccff92c3849b4cf7c9f0ee866a2002b76a Mon Sep 17 00:00:00 2001 From: Alexey Martemyanov Date: Mon, 18 Dec 2023 14:09:41 +0600 Subject: [PATCH 01/18] swiftlint build plugin (#1318) Task/Issue URL: https://app.asana.com/0/1205944207430351/1204377796839424/f BSK PR: duckduckgo/BrowserServicesKit#393 --- .github/workflows/pr.yml | 5 +- .swiftlint.tests.yml | 53 ----- .swiftlint.yml | 12 +- DuckDuckGo.xcodeproj/project.pbxproj | 216 ++++++++++++------ .../xcshareddata/swiftpm/Package.resolved | 4 +- .../Autofill/ContentOverlayPopover.swift | 2 +- .../Legacy/LegacyBookmarkStore.swift | 2 +- .../BookmarkAddPopoverViewController.swift | 2 +- DuckDuckGo/Common/Database/Stored.swift | 2 +- .../Common/Extensions/URLExtension.swift | 2 +- .../Configuration/ConfigurationStore.swift | 2 +- .../ClickToLoadUserScript.swift | 2 +- DuckDuckGo/DBP/DBPHomeViewController.swift | 2 +- .../DBP/LoginItem+DataBrokerProtection.swift | 2 +- .../BrowserImportMoreInfoViewController.swift | 2 +- .../Model/DataImportStatusProviding.swift | 2 +- .../View/AddEditFavoriteViewController.swift | 2 +- .../Menus/CleanThisHistoryMenuItem.swift | 2 +- .../NavigationBarBadgeAnimator.swift | 2 +- .../NetworkProtectionPixelEvent.swift | 2 +- ...erDefaults+NetworkProtectionWaitlist.swift | 2 +- .../EventMapping+NetworkProtectionError.swift | 2 +- .../NetworkProtectionInvitePresenter.swift | 2 +- .../LoginItem+NetworkProtection.swift | 2 +- ...etworkProtectionControllerErrorStore.swift | 2 +- ...etworkProtectionNavBarPopoverManager.swift | 2 +- .../VPNLocationPreferenceItem.swift | 2 +- .../VPNLocationPreferenceItemModel.swift | 2 +- .../VPNLocation/VPNLocationView.swift | 2 +- .../VPNLocation/VPNLocationViewModel.swift | 5 +- ...NetworkProtectionIPCTunnelController.swift | 2 +- ...UserText+NetworkProtectionExtensions.swift | 2 +- .../Bitwarden/Model/BWStatus.swift | 2 +- .../Model/VPNPreferencesModel.swift | 2 +- .../Preferences/View/PreferencesVPNView.swift | 2 +- .../Model/RecentlyClosedCacheItem.swift | 2 +- .../StatePersistenceService.swift | 2 +- .../View/SuggestionViewController.swift | 2 +- DuckDuckGo/Tab/Model/Tab+UIDelegate.swift | 2 +- DuckDuckGo/Tab/UserScripts/UserScripts.swift | 2 +- .../Waitlist/Views/WaitlistRootView.swift | 2 +- .../DuckPlayerURLExtension.swift | 2 +- ...ataBrokerProtectionBackgroundManager.swift | 4 +- ...kDuckGoDBPBackgroundAgentAppDelegate.swift | 2 +- IntegrationTests/.swiftlint.yml | 17 ++ .../AddressBarSpoofingIntegrationTests.swift | 2 +- LocalPackages/Account/Package.swift | 13 +- .../Account/Sources/Account/AuthService.swift | 2 - .../Tests/AccountTests/AccountsTests.swift | 2 +- .../Plugins/InputFilesChecker/Errors.swift | 2 +- .../InputFilesChecker/InputFilesChecker.swift | 2 +- .../DataBrokerProtection/Package.swift | 12 +- .../DataBrokerDatabaseBrowserView.swift | 2 +- .../IPC/DataBrokerProtectionIPCServer.swift | 2 +- .../Model/Actions/Navigate.swift | 2 +- .../Model/DBPUIViewModel.swift | 2 +- .../DataBrokerOperationRunner.swift | 2 +- .../DataBrokerProtectionBrokerUpdater.swift | 2 +- .../DataBrokerProtectionNoOpScheduler.swift | 2 +- .../Services/EmailService.swift | 2 +- .../Services/RedeemCodeServices.swift | 2 +- ...DataBrokerProtectionWebUIURLSettings.swift | 2 +- ...BrokerProtectionInviteCodeViewModels.swift | 2 +- ...ataBrokerProtectionInviteDialogsView.swift | 2 +- .../DataBrokerProtection/UI/UIMapper.swift | 10 +- .../Utils/CodableExtension.swift | 2 +- .../DataBrokerProtectionNotifications.swift | 2 +- ...kerProfileQueryOperationManagerTests.swift | 2 +- LocalPackages/LoginItems/Package.swift | 14 +- .../NetworkProtectionMac/Package.swift | 20 +- .../UserText+NetworkProtectionUI.swift | 2 +- .../TunnelControllerView.swift | 2 +- .../NetworkProtectionAssetTests.swift | 2 +- LocalPackages/PixelKit/Package.swift | 22 +- LocalPackages/Purchase/Package.swift | 15 +- LocalPackages/Subscription/Package.swift | 14 +- .../DebugMenu/SubscriptionDebugMenu.swift | 2 +- LocalPackages/SwiftUIExtensions/Package.swift | 14 +- .../SwiftUIExtensions/LetterIconView.swift | 2 +- .../NativeCheckBoxToggle.swift | 2 +- .../Sources/SwiftUIExtensions/View+Link.swift | 2 +- .../SwiftUIExtensions/View+Visibility.swift | 2 +- LocalPackages/SyncUI/Package.swift | 14 +- .../SyncUI/Views/internal/QRCodeView.swift | 2 +- .../SyncUI/Views/internal/SyncUIViews.swift | 2 +- .../SystemExtensionManager/Package.swift | 13 +- LocalPackages/XPCHelper/Package.swift | 10 +- ...rotectionAgentNotificationsPresenter.swift | 2 +- UITests/.swiftlint.yml | 17 ++ UnitTests/.swiftlint.yml | 17 ++ .../Bookmarks/Model/BookmarkNodeTests.swift | 2 +- .../Common/Extensions/HTTPCookieTests.swift | 2 +- .../Geolocation/CLLocationManagerMock.swift | 2 +- .../History/Services/HistoryStoringMock.swift | 1 + .../HomePage/ContinueSetUpModelTests.swift | 2 +- .../CapturingDefaultBrowserProvider.swift | 2 +- .../LocalPinningManagerTests.swift | 2 +- .../FireproofingReferenceTests.swift | 2 +- .../PasswordManagementListSectionTests.swift | 4 - .../PixelExperimentTests.swift | 2 +- .../TabBar/ViewModel/TabLazyLoaderTests.swift | 24 +- .../VPNFeedbackFormViewModelTests.swift | 3 - .../Waitlist/WaitlistViewModelTests.swift | 8 +- lint.sh | 57 ----- scripts/archive.sh | 2 + 105 files changed, 443 insertions(+), 329 deletions(-) delete mode 100644 .swiftlint.tests.yml create mode 100644 IntegrationTests/.swiftlint.yml create mode 100644 UITests/.swiftlint.yml create mode 100644 UnitTests/.swiftlint.yml delete mode 100755 lint.sh diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 4ad1e6db0a..1e776878f9 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -24,7 +24,7 @@ jobs: steps: - uses: actions/checkout@v3 - name: SwiftLint - uses: docker://norionomura/swiftlint:0.53.0 + uses: docker://norionomura/swiftlint:0.54.0 with: args: swiftlint --reporter github-actions-logging --strict @@ -133,6 +133,7 @@ jobs: -scheme "${{ matrix.scheme }}" \ -derivedDataPath "DerivedData" \ -configuration "CI" \ + -skipPackagePluginValidation \ ENABLE_TESTABILITY=true \ ONLY_ACTIVE_ARCH=${{ matrix.active-arch }} \ "-skip-testing:${{ matrix.integration-tests-target }}" \ @@ -146,6 +147,7 @@ jobs: -scheme "${{ matrix.scheme }}" \ -derivedDataPath "DerivedData" \ -configuration "CI" \ + -skipPackagePluginValidation \ ENABLE_TESTABILITY=true \ ONLY_ACTIVE_ARCH=${{ matrix.active-arch }} \ "-only-testing:${{ matrix.integration-tests-target }}" \ @@ -320,6 +322,7 @@ jobs: -scheme "${{ matrix.scheme }}" \ -derivedDataPath "DerivedData" \ -configuration "Release" \ + -skipPackagePluginValidation \ | tee release-xcodebuild.log \ | xcbeautify diff --git a/.swiftlint.tests.yml b/.swiftlint.tests.yml deleted file mode 100644 index 9f1ed37102..0000000000 --- a/.swiftlint.tests.yml +++ /dev/null @@ -1,53 +0,0 @@ -# swiftlint config applied for Tests - -disabled_rules: - - no_space_in_method_call - - multiple_closures_with_trailing_closure - - block_based_kvo - - compiler_protocol_init - - unused_setter_value - - line_length - - type_name - - force_cast - - force_try - - function_body_length - - cyclomatic_complexity - - identifier_name - - implicit_getter - - trailing_comma - - blanket_disable_command - -opt_in_rules: - - file_header - -# Rule Config -file_length: - warning: 1800 - error: 2000 -type_body_length: - warning: 1000 - error: 1500 -nesting: - type_level: 4 -large_tuple: - warning: 6 - error: 10 -file_header: - required_pattern: | - \/\/ - \/\/ .*?\.swift - \/\/ - \/\/ Copyright © \d{4} DuckDuckGo\. All rights reserved\. - \/\/ - \/\/ Licensed under the Apache License, Version 2\.0 \(the \"License\"\); - \/\/ you may not use this file except in compliance with the License\. - \/\/ You may obtain a copy of the License at - \/\/ - \/\/ http:\/\/www\.apache\.org\/licenses\/LICENSE-2\.0 - \/\/ - \/\/ Unless required by applicable law or agreed to in writing, software - \/\/ distributed under the License is distributed on an \"AS IS\" BASIS, - \/\/ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied\. - \/\/ See the License for the specific language governing permissions and - \/\/ limitations under the License\. - \/\/ diff --git a/.swiftlint.yml b/.swiftlint.yml index 3058699143..40a316303d 100644 --- a/.swiftlint.yml +++ b/.swiftlint.yml @@ -1,3 +1,5 @@ +allow_zero_lintable_files: true + disabled_rules: - no_space_in_method_call - multiple_closures_with_trailing_closure @@ -9,9 +11,12 @@ disabled_rules: - implicit_getter - function_parameter_count - trailing_comma + - nesting + - opening_brace opt_in_rules: - file_header + - explicit_init custom_rules: explicit_non_final_class: @@ -41,15 +46,13 @@ file_length: type_body_length: warning: 500 error: 500 -nesting: - type_level: 2 large_tuple: warning: 4 error: 5 file_header: required_pattern: | \/\/ - \/\/ .*?\.swift + \/\/ SWIFTLINT_CURRENT_FILENAME \/\/ \/\/ Copyright © \d{4} DuckDuckGo\. All rights reserved\. \/\/ @@ -69,11 +72,8 @@ file_header: # General Config excluded: - DuckDuckGo/Common/Localizables/UserText.swift - - UnitTests - - IntegrationTests - LocalPackages/*/Package.swift - release - - UITests - vendor - DerivedData - .ruby-lsp diff --git a/DuckDuckGo.xcodeproj/project.pbxproj b/DuckDuckGo.xcodeproj/project.pbxproj index d4f7e19267..6776156d71 100644 --- a/DuckDuckGo.xcodeproj/project.pbxproj +++ b/DuckDuckGo.xcodeproj/project.pbxproj @@ -7912,13 +7912,13 @@ 378E2798296F6D1D00FCADA2 /* Validate PRODUCT_NAME */, 3706FA79293F65D500E42796 /* Check Embedded Config URLs */, 3706FA7A293F65D500E42796 /* Sources */, - 3706FCA5293F65D500E42796 /* Swift Lint */, 3706FCA6293F65D500E42796 /* Frameworks */, 3706FCB1293F65D500E42796 /* Resources */, ); buildRules = ( ); dependencies = ( + B69D061C2A4C0BC10032D14D /* PBXTargetDependency */, 4B5F14FE2A1529230060320F /* PBXTargetDependency */, ); name = "DuckDuckGo Privacy Browser App Store"; @@ -7956,6 +7956,7 @@ buildRules = ( ); dependencies = ( + B69D06182A4C0AD20032D14D /* PBXTargetDependency */, 37079A93294236F20031BB3C /* PBXTargetDependency */, ); name = "Unit Tests App Store"; @@ -7979,6 +7980,7 @@ buildRules = ( ); dependencies = ( + B69D061A2A4C0AD80032D14D /* PBXTargetDependency */, B6EC37F429B5DA94001ACE79 /* PBXTargetDependency */, 37079A95294236FA0031BB3C /* PBXTargetDependency */, ); @@ -7998,6 +8000,7 @@ buildRules = ( ); dependencies = ( + B69D06162A4C0ACD0032D14D /* PBXTargetDependency */, B6EC37F229B5DA8F001ACE79 /* PBXTargetDependency */, 4B1AD8A325FC27E200261379 /* PBXTargetDependency */, ); @@ -8021,6 +8024,7 @@ buildRules = ( ); dependencies = ( + B6080B9F2B20AF7B00B418EF /* PBXTargetDependency */, ); name = NetworkProtectionSystemExtension; packageProductDependencies = ( @@ -8046,6 +8050,7 @@ buildRules = ( ); dependencies = ( + B6080BA32B20AF8300B418EF /* PBXTargetDependency */, 7BEC18312AD5DA3300D30536 /* PBXTargetDependency */, ); name = DuckDuckGoVPN; @@ -8074,6 +8079,7 @@ buildRules = ( ); dependencies = ( + B6080BA52B20AF8800B418EF /* PBXTargetDependency */, ); name = DuckDuckGoVPNAppStore; packageProductDependencies = ( @@ -8098,6 +8104,7 @@ buildRules = ( ); dependencies = ( + B6080BA12B20AF7F00B418EF /* PBXTargetDependency */, 4B4BEC4A2A11B627001D9AC5 /* PBXTargetDependency */, ); name = DuckDuckGoNotifications; @@ -8118,6 +8125,7 @@ buildRules = ( ); dependencies = ( + B6080B9D2B20AF7700B418EF /* PBXTargetDependency */, 4B4D60532A0B29CB00BCD287 /* PBXTargetDependency */, ); name = NetworkProtectionAppExtension; @@ -8138,7 +8146,6 @@ 4B9579432AC7AE700062CA31 /* Assert Xcode version */, 4B9579442AC7AE700062CA31 /* Check Embedded Config URLs */, 4B9579452AC7AE700062CA31 /* Sources */, - 4B957BD32AC7AE700062CA31 /* Swift Lint */, 4B957BD42AC7AE700062CA31 /* Frameworks */, 4B957BEC2AC7AE700062CA31 /* Resources */, 4B957C322AC7AE700062CA31 /* Make /Applications symlink, remove app on Clean build */, @@ -8194,6 +8201,7 @@ buildRules = ( ); dependencies = ( + B6080B9B2B20AF6400B418EF /* PBXTargetDependency */, 7B4CE8E026F02108009134B1 /* PBXTargetDependency */, ); name = "UI Tests"; @@ -8208,11 +8216,12 @@ 9D9AE8B62AAA39A70026E7DC /* Sources */, 9D9AE8C62AAA39A70026E7DC /* Frameworks */, 9D9AE8C92AAA39A70026E7DC /* Resources */, - 7BB34F502AD98394005691AE /* ShellScript */, + 7BB34F502AD98394005691AE /* Copy Swift Package resources */, ); buildRules = ( ); dependencies = ( + B6080BA92B20AF8F00B418EF /* PBXTargetDependency */, ); name = DuckDuckGoDBPBackgroundAgent; packageProductDependencies = ( @@ -8235,6 +8244,7 @@ buildRules = ( ); dependencies = ( + B6080BAB2B20AF9200B418EF /* PBXTargetDependency */, ); name = DuckDuckGoDBPBackgroundAgentAppStore; packageProductDependencies = ( @@ -8253,7 +8263,6 @@ CBCCF59E299667B700C02DFE /* Assert Xcode version */, 3705272528992C8A000C06A2 /* Check Embedded Config URLs */, AA585D7A248FD31100E9A3E2 /* Sources */, - AA8EDF2824925E940071C2E8 /* Swift Lint */, AA585D7B248FD31100E9A3E2 /* Frameworks */, AA585D7C248FD31100E9A3E2 /* Resources */, B6F2C8722A7A4C7D000498CF /* Make /Applications symlink, remove app on Clean build */, @@ -8262,6 +8271,7 @@ buildRules = ( ); dependencies = ( + B692D0DF2B209FB7003F2548 /* PBXTargetDependency */, 4B5F14FC2A15291D0060320F /* PBXTargetDependency */, 31C6E9AD2B0C07BA0086DC30 /* PBXTargetDependency */, ); @@ -8308,6 +8318,7 @@ buildRules = ( ); dependencies = ( + B69D06142A4C0AC50032D14D /* PBXTargetDependency */, AA585D92248FD31400E9A3E2 /* PBXTargetDependency */, ); name = "Unit Tests"; @@ -8787,25 +8798,6 @@ shellPath = /bin/sh; shellScript = "if [ \"$ENABLE_PREVIEWS\" = \"YES\" ]; then exit 0; fi\nif [ \"$CONFIGURATION\" == \"Release\" ]; then\n \"${SRCROOT}/scripts/update_embedded.sh\" -c\nfi\n"; }; - 3706FCA5293F65D500E42796 /* Swift Lint */ = { - isa = PBXShellScriptBuildPhase; - alwaysOutOfDate = 1; - buildActionMask = 2147483647; - files = ( - ); - inputFileListPaths = ( - ); - inputPaths = ( - ); - name = "Swift Lint"; - outputFileListPaths = ( - ); - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/zsh; - shellScript = "if [ \"$ENABLE_PREVIEWS\" = \"YES\" ]; then exit 0; fi\n./lint.sh\n"; - }; 378E2798296F6D1D00FCADA2 /* Validate PRODUCT_NAME */ = { isa = PBXShellScriptBuildPhase; alwaysOutOfDate = 1; @@ -8899,25 +8891,6 @@ shellPath = /bin/sh; shellScript = "if [ \"$CONFIGURATION\" == \"Release\" ]; then\n \"${SRCROOT}/scripts/update_embedded.sh\" -c\nfi\n"; }; - 4B957BD32AC7AE700062CA31 /* Swift Lint */ = { - isa = PBXShellScriptBuildPhase; - alwaysOutOfDate = 1; - buildActionMask = 2147483647; - files = ( - ); - inputFileListPaths = ( - ); - inputPaths = ( - ); - name = "Swift Lint"; - outputFileListPaths = ( - ); - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/zsh; - shellScript = "./lint.sh\n"; - }; 4B957C322AC7AE700062CA31 /* Make /Applications symlink, remove app on Clean build */ = { isa = PBXShellScriptBuildPhase; alwaysOutOfDate = 1; @@ -8939,6 +8912,7 @@ }; 7B31FD922AD126C40086AA24 /* Embed System Network Extension */ = { isa = PBXShellScriptBuildPhase; + alwaysOutOfDate = 1; buildActionMask = 2147483647; files = ( ); @@ -8974,7 +8948,7 @@ shellPath = /bin/sh; shellScript = "if [[ -z \"${SYSEX_BUNDLE_ID}\" ]]; then\n echo \"Required build settings are not defined, please check xcconfig files\"\n exit 1\nfi\n\n\necho \"ditto ${BUILT_PRODUCTS_DIR}/${SYSEX_BUNDLE_ID}.systemextension $BUILT_PRODUCTS_DIR/${CONTENTS_FOLDER_PATH}/Library/SystemExtensions/${SYSEX_BUNDLE_ID}.systemextension\"\n\nditto \"${BUILT_PRODUCTS_DIR}/${SYSEX_BUNDLE_ID}.systemextension\" \"$BUILT_PRODUCTS_DIR/${CONTENTS_FOLDER_PATH}/Library/SystemExtensions/${SYSEX_BUNDLE_ID}.systemextension\" || exit 1\n"; }; - 7BB34F502AD98394005691AE /* ShellScript */ = { + 7BB34F502AD98394005691AE /* Copy Swift Package resources */ = { isa = PBXShellScriptBuildPhase; alwaysOutOfDate = 1; buildActionMask = 2147483647; @@ -8984,6 +8958,7 @@ ); inputPaths = ( ); + name = "Copy Swift Package resources"; outputFileListPaths = ( ); outputPaths = ( @@ -8992,25 +8967,6 @@ shellPath = /bin/sh; shellScript = "# We had issues where the Swift Package resources were not being added to the Agent Apps,\n# so we're manually coping them here.\n# It seems to be a known issue: https://forums.swift.org/t/swift-packages-resource-bundle-not-present-in-xcarchive-when-framework-using-said-package-is-archived/50084/2\ncp -RL \"${BUILT_PRODUCTS_DIR}\"/ContentScopeScripts_ContentScopeScripts.bundle \"${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/\"\ncp -RL \"${BUILT_PRODUCTS_DIR}\"/DataBrokerProtection_DataBrokerProtection.bundle \"${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/\"\n"; }; - AA8EDF2824925E940071C2E8 /* Swift Lint */ = { - isa = PBXShellScriptBuildPhase; - alwaysOutOfDate = 1; - buildActionMask = 2147483647; - files = ( - ); - inputFileListPaths = ( - ); - inputPaths = ( - ); - name = "Swift Lint"; - outputFileListPaths = ( - ); - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/zsh; - shellScript = "if [ \"$ENABLE_PREVIEWS\" = \"YES\" ]; then exit 0; fi\n./lint.sh\n"; - }; B6BD8F0A2A260E5900B6A41F /* embed libswift_Concurrency.dylib */ = { isa = PBXShellScriptBuildPhase; alwaysOutOfDate = 1; @@ -9028,7 +8984,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "FRAMEWORKS_DIR=\"${BUILT_PRODUCTS_DIR}/${FRAMEWORKS_FOLDER_PATH}\"\nDYLIB_TARGET_PATH=\"${FRAMEWORKS_DIR}/libswift_Concurrency.dylib\"\n\nif [ ! -e \"${DYLIB_TARGET_PATH}\" ]; then\n\n DYLIB_PATH=$(find \"${TOOLCHAIN_DIR}/usr/lib\" -path \"*/${HOST_PLATFORM}/libswift_Concurrency.dylib\")\n echo \"copy ${DYLIB_PATH} to ${DYLIB_TARGET_PATH}\"\n\n mkdir -p \"${FRAMEWORKS_DIR}\"\n cp \"${DYLIB_PATH}\" \"${DYLIB_TARGET_PATH}\" || exit 1\n\nelse\n echo \"${DYLIB_TARGET_PATH} exists\"\nfi\n"; + shellScript = "FRAMEWORKS_DIR=\"${BUILT_PRODUCTS_DIR}/${FRAMEWORKS_FOLDER_PATH}\"\nDYLIB_TARGET_PATH=\"${FRAMEWORKS_DIR}/libswift_Concurrency.dylib\"\n\nif [ ! -e \"${DYLIB_TARGET_PATH}\" ]; then\n\n DYLIB_PATH=$(find \"${TOOLCHAIN_DIR}/usr/lib\" -path \"*/${HOST_PLATFORM}/libswift_Concurrency.dylib\")\n echo \"copy ${DYLIB_PATH} to ${DYLIB_TARGET_PATH}\"\n\n mkdir -p \"${FRAMEWORKS_DIR}\"\n cp \"${DYLIB_PATH}\" \"${DYLIB_TARGET_PATH}\" || exit 1\n\nelse\n echo \"${DYLIB_TARGET_PATH} exists 👌\"\nfi\n"; }; B6F2C8722A7A4C7D000498CF /* Make /Applications symlink, remove app on Clean build */ = { isa = PBXShellScriptBuildPhase; @@ -9047,7 +9003,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "if [[ \"${CONFIGURATION}\" != \"Debug\" ]]; then\n # run only for Debug builds\n exit 0\nfi\n\n# if Xcode created real Applications directory inside BUILT_PRODUCTS_DIR \nif [[ ! -L ${BUILT_PRODUCTS_DIR}/Applications ]]; then\n # we only get here on clean build, remove an existing app in /Applications/DEBUG on clean build\n echo \"rm -rf /${INSTALL_PATH}/${PRODUCT_NAME}.app\"\n rm -rf \"/${INSTALL_PATH}/${PRODUCT_NAME}.app\"\n\n # create /Applications/DEBUG dir\n echo \"mkdir -p /${INSTALL_PATH}\"\n mkdir -p \"/${INSTALL_PATH}\"\n\n # move the app bundle to /Applications/DEBUG\n echo \"mv ${DSTROOT}/${INSTALL_PATH}/${PRODUCT_NAME}.app /${INSTALL_PATH}/${PRODUCT_NAME}.app\"\n mv \"${DSTROOT}/${INSTALL_PATH}/${PRODUCT_NAME}.app\" \"/${INSTALL_PATH}/${PRODUCT_NAME}.app\"\n\n # rm ${BUILT_PRODUCTS_DIR}/Applications directory created by Xcode\n echo \"rm -rf ${BUILT_PRODUCTS_DIR}/Applications\" \n rm -rf \"${BUILT_PRODUCTS_DIR}/Applications\"\n # create ${BUILT_PRODUCTS_DIR}/Applications symlink to /Applications\n echo \"ln -s /Applications ${BUILT_PRODUCTS_DIR}/Applications\"\n ln -s /Applications \"${BUILT_PRODUCTS_DIR}/Applications\"\nfi\n"; + shellScript = "if [[ \"${CONFIGURATION}\" != \"Debug\" ]]; then\n # run only for Debug builds\n exit 0\nfi\n\n# if Xcode created real Applications directory inside BUILT_PRODUCTS_DIR \nif [[ ! -L ${BUILT_PRODUCTS_DIR}/Applications ]]; then\n # we only get here on clean build, remove an existing app in /Applications/DEBUG on clean build\n echo \"rm -rf /${INSTALL_PATH}/${PRODUCT_NAME}.app\"\n rm -rf \"/${INSTALL_PATH}/${PRODUCT_NAME}.app\"\n\n # create /Applications/DEBUG dir\n echo \"mkdir -p /${INSTALL_PATH}\"\n mkdir -p \"/${INSTALL_PATH}\"\n\n # move the app bundle to /Applications/DEBUG\n echo \"mv ${DSTROOT}/${INSTALL_PATH}/${PRODUCT_NAME}.app /${INSTALL_PATH}/${PRODUCT_NAME}.app\"\n mv \"${DSTROOT}/${INSTALL_PATH}/${PRODUCT_NAME}.app\" \"/${INSTALL_PATH}/${PRODUCT_NAME}.app\"\n\n # rm ${BUILT_PRODUCTS_DIR}/Applications directory created by Xcode\n echo \"rm -rf ${BUILT_PRODUCTS_DIR}/Applications\" \n rm -rf \"${BUILT_PRODUCTS_DIR}/Applications\"\n # create ${BUILT_PRODUCTS_DIR}/Applications symlink to /Applications\n echo \"ln -s /Applications ${BUILT_PRODUCTS_DIR}/Applications\"\n ln -s /Applications \"${BUILT_PRODUCTS_DIR}/Applications\"\nelse\n echo \"/Applications symlink 👌\"\nfi\n"; }; CBCCF59E299667B700C02DFE /* Assert Xcode version */ = { isa = PBXShellScriptBuildPhase; @@ -11910,6 +11866,66 @@ target = AA585D7D248FD31100E9A3E2 /* DuckDuckGo Privacy Browser */; targetProxy = AA585D91248FD31400E9A3E2 /* PBXContainerItemProxy */; }; + B6080B9B2B20AF6400B418EF /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + productRef = B6080B9A2B20AF6400B418EF /* SwiftLintPlugin */; + }; + B6080B9D2B20AF7700B418EF /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + productRef = B6080B9C2B20AF7700B418EF /* SwiftLintPlugin */; + }; + B6080B9F2B20AF7B00B418EF /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + productRef = B6080B9E2B20AF7B00B418EF /* SwiftLintPlugin */; + }; + B6080BA12B20AF7F00B418EF /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + productRef = B6080BA02B20AF7F00B418EF /* SwiftLintPlugin */; + }; + B6080BA32B20AF8300B418EF /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + productRef = B6080BA22B20AF8300B418EF /* SwiftLintPlugin */; + }; + B6080BA52B20AF8800B418EF /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + productRef = B6080BA42B20AF8800B418EF /* SwiftLintPlugin */; + }; + B6080BA72B20AF8B00B418EF /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + productRef = B6080BA62B20AF8B00B418EF /* SwiftLintPlugin */; + }; + B6080BA92B20AF8F00B418EF /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + productRef = B6080BA82B20AF8F00B418EF /* SwiftLintPlugin */; + }; + B6080BAB2B20AF9200B418EF /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + productRef = B6080BAA2B20AF9200B418EF /* SwiftLintPlugin */; + }; + B692D0DF2B209FB7003F2548 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + productRef = B692D0DE2B209FB7003F2548 /* SwiftLintPlugin */; + }; + B69D06142A4C0AC50032D14D /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + productRef = B69D06132A4C0AC50032D14D /* SwiftLintPlugin */; + }; + B69D06162A4C0ACD0032D14D /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + productRef = B69D06152A4C0ACD0032D14D /* SwiftLintPlugin */; + }; + B69D06182A4C0AD20032D14D /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + productRef = B69D06172A4C0AD20032D14D /* SwiftLintPlugin */; + }; + B69D061A2A4C0AD80032D14D /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + productRef = B69D06192A4C0AD80032D14D /* SwiftLintPlugin */; + }; + B69D061C2A4C0BC10032D14D /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + productRef = B69D061B2A4C0BC10032D14D /* SwiftLintPlugin */; + }; B6EC37F229B5DA8F001ACE79 /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = B6EC37E729B5DA2A001ACE79 /* tests-server */; @@ -12720,7 +12736,7 @@ repositoryURL = "https://github.com/duckduckgo/BrowserServicesKit"; requirement = { kind = exactVersion; - version = 94.0.2; + version = 94.0.3; }; }; AA06B6B52672AF8100F541C5 /* XCRemoteSwiftPackageReference "Sparkle" */ = { @@ -13175,6 +13191,76 @@ package = AA06B6B52672AF8100F541C5 /* XCRemoteSwiftPackageReference "Sparkle" */; productName = Sparkle; }; + B6080B9A2B20AF6400B418EF /* SwiftLintPlugin */ = { + isa = XCSwiftPackageProductDependency; + package = 9807F643278CA16F00E1547B /* XCRemoteSwiftPackageReference "BrowserServicesKit" */; + productName = "plugin:SwiftLintPlugin"; + }; + B6080B9C2B20AF7700B418EF /* SwiftLintPlugin */ = { + isa = XCSwiftPackageProductDependency; + package = 9807F643278CA16F00E1547B /* XCRemoteSwiftPackageReference "BrowserServicesKit" */; + productName = "plugin:SwiftLintPlugin"; + }; + B6080B9E2B20AF7B00B418EF /* SwiftLintPlugin */ = { + isa = XCSwiftPackageProductDependency; + package = 9807F643278CA16F00E1547B /* XCRemoteSwiftPackageReference "BrowserServicesKit" */; + productName = "plugin:SwiftLintPlugin"; + }; + B6080BA02B20AF7F00B418EF /* SwiftLintPlugin */ = { + isa = XCSwiftPackageProductDependency; + package = 9807F643278CA16F00E1547B /* XCRemoteSwiftPackageReference "BrowserServicesKit" */; + productName = "plugin:SwiftLintPlugin"; + }; + B6080BA22B20AF8300B418EF /* SwiftLintPlugin */ = { + isa = XCSwiftPackageProductDependency; + package = 9807F643278CA16F00E1547B /* XCRemoteSwiftPackageReference "BrowserServicesKit" */; + productName = "plugin:SwiftLintPlugin"; + }; + B6080BA42B20AF8800B418EF /* SwiftLintPlugin */ = { + isa = XCSwiftPackageProductDependency; + package = 9807F643278CA16F00E1547B /* XCRemoteSwiftPackageReference "BrowserServicesKit" */; + productName = "plugin:SwiftLintPlugin"; + }; + B6080BA62B20AF8B00B418EF /* SwiftLintPlugin */ = { + isa = XCSwiftPackageProductDependency; + package = 9807F643278CA16F00E1547B /* XCRemoteSwiftPackageReference "BrowserServicesKit" */; + productName = "plugin:SwiftLintPlugin"; + }; + B6080BA82B20AF8F00B418EF /* SwiftLintPlugin */ = { + isa = XCSwiftPackageProductDependency; + package = 9807F643278CA16F00E1547B /* XCRemoteSwiftPackageReference "BrowserServicesKit" */; + productName = "plugin:SwiftLintPlugin"; + }; + B6080BAA2B20AF9200B418EF /* SwiftLintPlugin */ = { + isa = XCSwiftPackageProductDependency; + package = 9807F643278CA16F00E1547B /* XCRemoteSwiftPackageReference "BrowserServicesKit" */; + productName = "plugin:SwiftLintPlugin"; + }; + B692D0DE2B209FB7003F2548 /* SwiftLintPlugin */ = { + isa = XCSwiftPackageProductDependency; + package = 9807F643278CA16F00E1547B /* XCRemoteSwiftPackageReference "BrowserServicesKit" */; + productName = "plugin:SwiftLintPlugin"; + }; + B69D06132A4C0AC50032D14D /* SwiftLintPlugin */ = { + isa = XCSwiftPackageProductDependency; + productName = "plugin:SwiftLintPlugin"; + }; + B69D06152A4C0ACD0032D14D /* SwiftLintPlugin */ = { + isa = XCSwiftPackageProductDependency; + productName = "plugin:SwiftLintPlugin"; + }; + B69D06172A4C0AD20032D14D /* SwiftLintPlugin */ = { + isa = XCSwiftPackageProductDependency; + productName = "plugin:SwiftLintPlugin"; + }; + B69D06192A4C0AD80032D14D /* SwiftLintPlugin */ = { + isa = XCSwiftPackageProductDependency; + productName = "plugin:SwiftLintPlugin"; + }; + B69D061B2A4C0BC10032D14D /* SwiftLintPlugin */ = { + isa = XCSwiftPackageProductDependency; + productName = "plugin:SwiftLintPlugin"; + }; B6AE39F229374AEC00C37AA4 /* OHHTTPStubs */ = { isa = XCSwiftPackageProductDependency; package = B6DA44152616C13800DD1EC2 /* XCRemoteSwiftPackageReference "OHHTTPStubs" */; diff --git a/DuckDuckGo.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/DuckDuckGo.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index ba0d558e52..e39bf94e1a 100644 --- a/DuckDuckGo.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/DuckDuckGo.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -14,8 +14,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/duckduckgo/BrowserServicesKit", "state" : { - "revision" : "861b8a72930f138cd18b6a7722502a8a40375827", - "version" : "94.0.2" + "revision" : "d07e18b3785d31c15364e56bdd2cb4b27edd35d0", + "version" : "94.0.3" } }, { diff --git a/DuckDuckGo/Autofill/ContentOverlayPopover.swift b/DuckDuckGo/Autofill/ContentOverlayPopover.swift index 89cdc475c4..d6d1bb1fc0 100644 --- a/DuckDuckGo/Autofill/ContentOverlayPopover.swift +++ b/DuckDuckGo/Autofill/ContentOverlayPopover.swift @@ -43,7 +43,7 @@ public final class ContentOverlayPopover { layer.masksToBounds = true layer.cornerRadius = 6 layer.borderWidth = 0.5 - layer.borderColor = CGColor.init(gray: 0, alpha: 0.3) // Looks a little lighter than 0.2 in the CSS + layer.borderColor = CGColor(gray: 0, alpha: 0.3) // Looks a little lighter than 0.2 in the CSS } viewController.view.window?.backgroundColor = .clear viewController.view.window?.acceptsMouseMovedEvents = true diff --git a/DuckDuckGo/Bookmarks/Legacy/LegacyBookmarkStore.swift b/DuckDuckGo/Bookmarks/Legacy/LegacyBookmarkStore.swift index 145ef4e994..9634ca221f 100644 --- a/DuckDuckGo/Bookmarks/Legacy/LegacyBookmarkStore.swift +++ b/DuckDuckGo/Bookmarks/Legacy/LegacyBookmarkStore.swift @@ -1,5 +1,5 @@ // -// BookmarkStore.swift +// LegacyBookmarkStore.swift // // Copyright © 2023 DuckDuckGo. All rights reserved. // diff --git a/DuckDuckGo/Bookmarks/View/BookmarkAddPopoverViewController.swift b/DuckDuckGo/Bookmarks/View/BookmarkAddPopoverViewController.swift index 55fe78d279..53493da240 100644 --- a/DuckDuckGo/Bookmarks/View/BookmarkAddPopoverViewController.swift +++ b/DuckDuckGo/Bookmarks/View/BookmarkAddPopoverViewController.swift @@ -1,5 +1,5 @@ // -// BookmarkPopoverViewController.swift +// BookmarkAddPopoverViewController.swift // // Copyright © 2021 DuckDuckGo. All rights reserved. // diff --git a/DuckDuckGo/Common/Database/Stored.swift b/DuckDuckGo/Common/Database/Stored.swift index bda6c63a35..69f2c40de1 100644 --- a/DuckDuckGo/Common/Database/Stored.swift +++ b/DuckDuckGo/Common/Database/Stored.swift @@ -1,5 +1,5 @@ // -// StoredObject.swift +// Stored.swift // // Copyright © 2022 DuckDuckGo. All rights reserved. // diff --git a/DuckDuckGo/Common/Extensions/URLExtension.swift b/DuckDuckGo/Common/Extensions/URLExtension.swift index 23f2ad3d4d..827d9cb330 100644 --- a/DuckDuckGo/Common/Extensions/URLExtension.swift +++ b/DuckDuckGo/Common/Extensions/URLExtension.swift @@ -387,7 +387,7 @@ extension URL { func sanitizedForQuarantine() -> URL? { guard !self.isFileURL, !["data", "blob"].contains(self.scheme), - var components = URLComponents.init(url: self, resolvingAgainstBaseURL: false) + var components = URLComponents(url: self, resolvingAgainstBaseURL: false) else { return nil } diff --git a/DuckDuckGo/Configuration/ConfigurationStore.swift b/DuckDuckGo/Configuration/ConfigurationStore.swift index 15891111a3..179e5addd7 100644 --- a/DuckDuckGo/Configuration/ConfigurationStore.swift +++ b/DuckDuckGo/Configuration/ConfigurationStore.swift @@ -1,5 +1,5 @@ // -// ConfigurationStoring.swift +// ConfigurationStore.swift // // Copyright © 2021 DuckDuckGo. All rights reserved. // diff --git a/DuckDuckGo/ContentBlocker/ClickToLoadUserScript.swift b/DuckDuckGo/ContentBlocker/ClickToLoadUserScript.swift index 472af05a9d..ef06cf4216 100644 --- a/DuckDuckGo/ContentBlocker/ClickToLoadUserScript.swift +++ b/DuckDuckGo/ContentBlocker/ClickToLoadUserScript.swift @@ -58,7 +58,7 @@ final class ClickToLoadUserScript: NSObject, UserScript, WKScriptMessageHandlerW } if message.name == "enableFacebook" { guard let delegate = delegate else { return } - delegate.clickToLoadUserScriptAllowFB(self) { (_) -> Void in + delegate.clickToLoadUserScriptAllowFB(self) { _ in guard let isLogin = message.body as? Bool else { replyHandler(nil, nil) return diff --git a/DuckDuckGo/DBP/DBPHomeViewController.swift b/DuckDuckGo/DBP/DBPHomeViewController.swift index fa57310350..56d36b2afa 100644 --- a/DuckDuckGo/DBP/DBPHomeViewController.swift +++ b/DuckDuckGo/DBP/DBPHomeViewController.swift @@ -46,7 +46,7 @@ final class DBPHomeViewController: NSViewController { let privacySettings = PrivacySecurityPreferences.shared let sessionKey = UUID().uuidString - let prefs = ContentScopeProperties.init(gpcEnabled: privacySettings.gpcEnabled, + let prefs = ContentScopeProperties(gpcEnabled: privacySettings.gpcEnabled, sessionKey: sessionKey, featureToggles: features) diff --git a/DuckDuckGo/DBP/LoginItem+DataBrokerProtection.swift b/DuckDuckGo/DBP/LoginItem+DataBrokerProtection.swift index 50413b3acf..e1e00e38c7 100644 --- a/DuckDuckGo/DBP/LoginItem+DataBrokerProtection.swift +++ b/DuckDuckGo/DBP/LoginItem+DataBrokerProtection.swift @@ -1,5 +1,5 @@ // -// LoginItem.swift +// LoginItem+DataBrokerProtection.swift // // Copyright © 2023 DuckDuckGo. All rights reserved. // diff --git a/DuckDuckGo/DataImport/View/BrowserImportMoreInfoViewController.swift b/DuckDuckGo/DataImport/View/BrowserImportMoreInfoViewController.swift index 53374dc830..18263ab43c 100644 --- a/DuckDuckGo/DataImport/View/BrowserImportMoreInfoViewController.swift +++ b/DuckDuckGo/DataImport/View/BrowserImportMoreInfoViewController.swift @@ -29,7 +29,7 @@ final class BrowserImportMoreInfoViewController: NSViewController { let storyboard = NSStoryboard(name: Constants.storyboardName, bundle: nil) return storyboard.instantiateController(identifier: Constants.identifier) { (coder) -> Self? in - return Self.init(coder: coder, source: source) + return Self(coder: coder, source: source) } } diff --git a/DuckDuckGo/HomePage/Model/DataImportStatusProviding.swift b/DuckDuckGo/HomePage/Model/DataImportStatusProviding.swift index 026e1582f0..3ce04a4a41 100644 --- a/DuckDuckGo/HomePage/Model/DataImportStatusProviding.swift +++ b/DuckDuckGo/HomePage/Model/DataImportStatusProviding.swift @@ -1,5 +1,5 @@ // -// DataImportProvider.swift +// DataImportStatusProviding.swift // // Copyright © 2023 DuckDuckGo. All rights reserved. // diff --git a/DuckDuckGo/HomePage/View/AddEditFavoriteViewController.swift b/DuckDuckGo/HomePage/View/AddEditFavoriteViewController.swift index 3be8132f39..e84440246a 100644 --- a/DuckDuckGo/HomePage/View/AddEditFavoriteViewController.swift +++ b/DuckDuckGo/HomePage/View/AddEditFavoriteViewController.swift @@ -33,7 +33,7 @@ final class AddEditFavoriteViewController: NSViewController { static func create(bookmark: Bookmark? = nil) -> AddEditFavoriteViewController { NSStoryboard(name: "AddEditFavoriteViewController", bundle: .main).instantiateInitialController { - let addEditFavoriteViewController = AddEditFavoriteViewController.init(coder: $0) + let addEditFavoriteViewController = AddEditFavoriteViewController(coder: $0) if let bookmark { addEditFavoriteViewController?.edit(bookmark: bookmark) } diff --git a/DuckDuckGo/Menus/CleanThisHistoryMenuItem.swift b/DuckDuckGo/Menus/CleanThisHistoryMenuItem.swift index 6221131fb0..f21f662eea 100644 --- a/DuckDuckGo/Menus/CleanThisHistoryMenuItem.swift +++ b/DuckDuckGo/Menus/CleanThisHistoryMenuItem.swift @@ -1,5 +1,5 @@ // -// ClearThisHistoryMenuItem.swift +// CleanThisHistoryMenuItem.swift // // Copyright © 2022 DuckDuckGo. All rights reserved. // diff --git a/DuckDuckGo/NavigationBar/View/Animations/BadgeAnimations/NavigationBarBadgeAnimator.swift b/DuckDuckGo/NavigationBar/View/Animations/BadgeAnimations/NavigationBarBadgeAnimator.swift index e6777985bd..61a00d108b 100644 --- a/DuckDuckGo/NavigationBar/View/Animations/BadgeAnimations/NavigationBarBadgeAnimator.swift +++ b/DuckDuckGo/NavigationBar/View/Animations/BadgeAnimations/NavigationBarBadgeAnimator.swift @@ -1,5 +1,5 @@ // -// AddressBarButtonsBadgeAnimator.swift +// NavigationBarBadgeAnimator.swift // // Copyright © 2022 DuckDuckGo. All rights reserved. // diff --git a/DuckDuckGo/NetworkProtection/AppAndExtensionAndAgentTargets/NetworkProtectionPixelEvent.swift b/DuckDuckGo/NetworkProtection/AppAndExtensionAndAgentTargets/NetworkProtectionPixelEvent.swift index af341e35be..9a814f45e0 100644 --- a/DuckDuckGo/NetworkProtection/AppAndExtensionAndAgentTargets/NetworkProtectionPixelEvent.swift +++ b/DuckDuckGo/NetworkProtection/AppAndExtensionAndAgentTargets/NetworkProtectionPixelEvent.swift @@ -1,5 +1,5 @@ // -// NetworkProtectionPixel.swift +// NetworkProtectionPixelEvent.swift // // Copyright © 2023 DuckDuckGo. All rights reserved. // diff --git a/DuckDuckGo/NetworkProtection/AppAndExtensionAndAgentTargets/UserDefaults+NetworkProtectionWaitlist.swift b/DuckDuckGo/NetworkProtection/AppAndExtensionAndAgentTargets/UserDefaults+NetworkProtectionWaitlist.swift index e48aafc37c..c557fb2605 100644 --- a/DuckDuckGo/NetworkProtection/AppAndExtensionAndAgentTargets/UserDefaults+NetworkProtectionWaitlist.swift +++ b/DuckDuckGo/NetworkProtection/AppAndExtensionAndAgentTargets/UserDefaults+NetworkProtectionWaitlist.swift @@ -1,5 +1,5 @@ // -// PrivacyFeatureOverrideStore.swift +// UserDefaults+NetworkProtectionWaitlist.swift // // Copyright © 2023 DuckDuckGo. All rights reserved. // diff --git a/DuckDuckGo/NetworkProtection/AppTargets/BothAppTargets/EventMapping+NetworkProtectionError.swift b/DuckDuckGo/NetworkProtection/AppTargets/BothAppTargets/EventMapping+NetworkProtectionError.swift index 78883281fa..7d8124b432 100644 --- a/DuckDuckGo/NetworkProtection/AppTargets/BothAppTargets/EventMapping+NetworkProtectionError.swift +++ b/DuckDuckGo/NetworkProtection/AppTargets/BothAppTargets/EventMapping+NetworkProtectionError.swift @@ -1,5 +1,5 @@ // -// NetworkProtectionDeviceManager+EventMapping.swift +// EventMapping+NetworkProtectionError.swift // // Copyright © 2023 DuckDuckGo. All rights reserved. // diff --git a/DuckDuckGo/NetworkProtection/AppTargets/BothAppTargets/Invite/NetworkProtectionInvitePresenter.swift b/DuckDuckGo/NetworkProtection/AppTargets/BothAppTargets/Invite/NetworkProtectionInvitePresenter.swift index 9133f5201d..f80e5eb093 100644 --- a/DuckDuckGo/NetworkProtection/AppTargets/BothAppTargets/Invite/NetworkProtectionInvitePresenter.swift +++ b/DuckDuckGo/NetworkProtection/AppTargets/BothAppTargets/Invite/NetworkProtectionInvitePresenter.swift @@ -1,5 +1,5 @@ // -// NetworkProtectionVisibilityController.swift +// NetworkProtectionInvitePresenter.swift // // Copyright © 2023 DuckDuckGo. All rights reserved. // diff --git a/DuckDuckGo/NetworkProtection/AppTargets/BothAppTargets/LoginItem+NetworkProtection.swift b/DuckDuckGo/NetworkProtection/AppTargets/BothAppTargets/LoginItem+NetworkProtection.swift index 38caf2dc7c..a34f1d0faa 100644 --- a/DuckDuckGo/NetworkProtection/AppTargets/BothAppTargets/LoginItem+NetworkProtection.swift +++ b/DuckDuckGo/NetworkProtection/AppTargets/BothAppTargets/LoginItem+NetworkProtection.swift @@ -1,5 +1,5 @@ // -// LoginItem.swift +// LoginItem+NetworkProtection.swift // // Copyright © 2023 DuckDuckGo. All rights reserved. // diff --git a/DuckDuckGo/NetworkProtection/AppTargets/BothAppTargets/NetworkProtectionControllerErrorStore.swift b/DuckDuckGo/NetworkProtection/AppTargets/BothAppTargets/NetworkProtectionControllerErrorStore.swift index 6b615db3ad..62503023be 100644 --- a/DuckDuckGo/NetworkProtection/AppTargets/BothAppTargets/NetworkProtectionControllerErrorStore.swift +++ b/DuckDuckGo/NetworkProtection/AppTargets/BothAppTargets/NetworkProtectionControllerErrorStore.swift @@ -1,5 +1,5 @@ // -// NetworkProtectionControllerIssuesStore.swift +// NetworkProtectionControllerErrorStore.swift // // Copyright © 2023 DuckDuckGo. All rights reserved. // diff --git a/DuckDuckGo/NetworkProtection/AppTargets/BothAppTargets/NetworkProtectionNavBarPopoverManager.swift b/DuckDuckGo/NetworkProtection/AppTargets/BothAppTargets/NetworkProtectionNavBarPopoverManager.swift index 64b5642fe3..6d811b056a 100644 --- a/DuckDuckGo/NetworkProtection/AppTargets/BothAppTargets/NetworkProtectionNavBarPopoverManager.swift +++ b/DuckDuckGo/NetworkProtection/AppTargets/BothAppTargets/NetworkProtectionNavBarPopoverManager.swift @@ -1,5 +1,5 @@ // -// NetworkProtectionNavBarPopoverModel.swift +// NetworkProtectionNavBarPopoverManager.swift // // Copyright © 2023 DuckDuckGo. All rights reserved. // diff --git a/DuckDuckGo/NetworkProtection/AppTargets/BothAppTargets/VPNLocation/VPNLocationPreferenceItem.swift b/DuckDuckGo/NetworkProtection/AppTargets/BothAppTargets/VPNLocation/VPNLocationPreferenceItem.swift index ee139d7de2..0b6cfe5069 100644 --- a/DuckDuckGo/NetworkProtection/AppTargets/BothAppTargets/VPNLocation/VPNLocationPreferenceItem.swift +++ b/DuckDuckGo/NetworkProtection/AppTargets/BothAppTargets/VPNLocation/VPNLocationPreferenceItem.swift @@ -1,5 +1,5 @@ // -// NetworkProtectionVPNLocationPreferenceItem.swift +// VPNLocationPreferenceItem.swift // // Copyright © 2023 DuckDuckGo. All rights reserved. // diff --git a/DuckDuckGo/NetworkProtection/AppTargets/BothAppTargets/VPNLocation/VPNLocationPreferenceItemModel.swift b/DuckDuckGo/NetworkProtection/AppTargets/BothAppTargets/VPNLocation/VPNLocationPreferenceItemModel.swift index ea0e505b32..dc0ea89271 100644 --- a/DuckDuckGo/NetworkProtection/AppTargets/BothAppTargets/VPNLocation/VPNLocationPreferenceItemModel.swift +++ b/DuckDuckGo/NetworkProtection/AppTargets/BothAppTargets/VPNLocation/VPNLocationPreferenceItemModel.swift @@ -1,5 +1,5 @@ // -// NetworkProtectionLocationSettingsItemModel.swift +// VPNLocationPreferenceItemModel.swift // // Copyright © 2023 DuckDuckGo. All rights reserved. // diff --git a/DuckDuckGo/NetworkProtection/AppTargets/BothAppTargets/VPNLocation/VPNLocationView.swift b/DuckDuckGo/NetworkProtection/AppTargets/BothAppTargets/VPNLocation/VPNLocationView.swift index a19ecca45d..dec1e1cf46 100644 --- a/DuckDuckGo/NetworkProtection/AppTargets/BothAppTargets/VPNLocation/VPNLocationView.swift +++ b/DuckDuckGo/NetworkProtection/AppTargets/BothAppTargets/VPNLocation/VPNLocationView.swift @@ -1,5 +1,5 @@ // -// NetworkProtectionVPNLocationView.swift +// VPNLocationView.swift // // Copyright © 2023 DuckDuckGo. All rights reserved. // diff --git a/DuckDuckGo/NetworkProtection/AppTargets/BothAppTargets/VPNLocation/VPNLocationViewModel.swift b/DuckDuckGo/NetworkProtection/AppTargets/BothAppTargets/VPNLocation/VPNLocationViewModel.swift index 9ad4aba68f..09a3af829c 100644 --- a/DuckDuckGo/NetworkProtection/AppTargets/BothAppTargets/VPNLocation/VPNLocationViewModel.swift +++ b/DuckDuckGo/NetworkProtection/AppTargets/BothAppTargets/VPNLocation/VPNLocationViewModel.swift @@ -1,5 +1,5 @@ // -// NetworkProtectionVPNLocationViewModel.swift +// VPNLocationViewModel.swift // // Copyright © 2023 DuckDuckGo. All rights reserved. // @@ -89,7 +89,6 @@ final class VPNLocationViewModel: ObservableObject { case .location(let location): isCountrySelected = location.country == currentLocation.country cityPickerItems = currentLocation.cities.map { currentCity in - let isCitySelected = currentCity.name == location.city return CityItem(cityName: currentCity.name) } selectedCityItem = location.city.flatMap(CityItem.init(cityName:)) ?? .nearest @@ -157,7 +156,7 @@ struct VPNCityItemModel: Identifiable, Hashable { extension VPNCityItemModel { static var nearest: VPNCityItemModel { - Self.init(cityName: UserText.vpnLocationNearest) + VPNCityItemModel(cityName: UserText.vpnLocationNearest) } } diff --git a/DuckDuckGo/NetworkProtection/AppTargets/DeveloperIDTarget/NetworkProtectionIPCTunnelController.swift b/DuckDuckGo/NetworkProtection/AppTargets/DeveloperIDTarget/NetworkProtectionIPCTunnelController.swift index ffe7a832b7..ada65d6335 100644 --- a/DuckDuckGo/NetworkProtection/AppTargets/DeveloperIDTarget/NetworkProtectionIPCTunnelController.swift +++ b/DuckDuckGo/NetworkProtection/AppTargets/DeveloperIDTarget/NetworkProtectionIPCTunnelController.swift @@ -1,5 +1,5 @@ // -// NetworkProtectionIPCClient.swift +// NetworkProtectionIPCTunnelController.swift // // Copyright © 2023 DuckDuckGo. All rights reserved. // diff --git a/DuckDuckGo/NetworkProtection/NetworkExtensionTargets/NetworkExtensionAndNotificationTargets/UserText+NetworkProtectionExtensions.swift b/DuckDuckGo/NetworkProtection/NetworkExtensionTargets/NetworkExtensionAndNotificationTargets/UserText+NetworkProtectionExtensions.swift index 6395cd11b0..2befdf07ce 100644 --- a/DuckDuckGo/NetworkProtection/NetworkExtensionTargets/NetworkExtensionAndNotificationTargets/UserText+NetworkProtectionExtensions.swift +++ b/DuckDuckGo/NetworkProtection/NetworkExtensionTargets/NetworkExtensionAndNotificationTargets/UserText+NetworkProtectionExtensions.swift @@ -1,5 +1,5 @@ // -// UserText.swift +// UserText+NetworkProtectionExtensions.swift // // Copyright © 2023 DuckDuckGo. All rights reserved. // diff --git a/DuckDuckGo/PasswordManager/Bitwarden/Model/BWStatus.swift b/DuckDuckGo/PasswordManager/Bitwarden/Model/BWStatus.swift index f7f4d0479d..05b1193940 100644 --- a/DuckDuckGo/PasswordManager/Bitwarden/Model/BWStatus.swift +++ b/DuckDuckGo/PasswordManager/Bitwarden/Model/BWStatus.swift @@ -1,5 +1,5 @@ // -// BitwardenState.swift +// BWStatus.swift // // Copyright © 2022 DuckDuckGo. All rights reserved. // diff --git a/DuckDuckGo/Preferences/Model/VPNPreferencesModel.swift b/DuckDuckGo/Preferences/Model/VPNPreferencesModel.swift index 54c2a5420e..09d228cb82 100644 --- a/DuckDuckGo/Preferences/Model/VPNPreferencesModel.swift +++ b/DuckDuckGo/Preferences/Model/VPNPreferencesModel.swift @@ -1,5 +1,5 @@ // -// PrivacyPreferencesModel.swift +// VPNPreferencesModel.swift // // Copyright © 2022 DuckDuckGo. All rights reserved. // diff --git a/DuckDuckGo/Preferences/View/PreferencesVPNView.swift b/DuckDuckGo/Preferences/View/PreferencesVPNView.swift index 7b16780933..0f1816f296 100644 --- a/DuckDuckGo/Preferences/View/PreferencesVPNView.swift +++ b/DuckDuckGo/Preferences/View/PreferencesVPNView.swift @@ -1,5 +1,5 @@ // -// PreferencesPrivacyView.swift +// PreferencesVPNView.swift // // Copyright © 2022 DuckDuckGo. All rights reserved. // diff --git a/DuckDuckGo/RecentlyClosed/Model/RecentlyClosedCacheItem.swift b/DuckDuckGo/RecentlyClosed/Model/RecentlyClosedCacheItem.swift index 8daac76c51..3314b3da2a 100644 --- a/DuckDuckGo/RecentlyClosed/Model/RecentlyClosedCacheItem.swift +++ b/DuckDuckGo/RecentlyClosed/Model/RecentlyClosedCacheItem.swift @@ -1,5 +1,5 @@ // -// RecentlyClosedTabsCacheItem.swift +// RecentlyClosedCacheItem.swift // // Copyright © 2022 DuckDuckGo. All rights reserved. // diff --git a/DuckDuckGo/StateRestoration/StatePersistenceService.swift b/DuckDuckGo/StateRestoration/StatePersistenceService.swift index 8e7cd8cdd4..6aed78934a 100644 --- a/DuckDuckGo/StateRestoration/StatePersistenceService.swift +++ b/DuckDuckGo/StateRestoration/StatePersistenceService.swift @@ -105,7 +105,7 @@ final class StatePersistenceService { guard let data = fileStore.decrypt(archive) else { throw CocoaError(.fileReadNoSuchFile) } - let unarchiver = try NSKeyedUnarchiver.init(forReadingFrom: data) + let unarchiver = try NSKeyedUnarchiver(forReadingFrom: data) try restore(unarchiver) } diff --git a/DuckDuckGo/Suggestions/View/SuggestionViewController.swift b/DuckDuckGo/Suggestions/View/SuggestionViewController.swift index cd04ff8a69..44442c1f86 100644 --- a/DuckDuckGo/Suggestions/View/SuggestionViewController.swift +++ b/DuckDuckGo/Suggestions/View/SuggestionViewController.swift @@ -1,5 +1,5 @@ // -// SearchSuggestionViewController.swift +// SuggestionViewController.swift // // Copyright © 2020 DuckDuckGo. All rights reserved. // diff --git a/DuckDuckGo/Tab/Model/Tab+UIDelegate.swift b/DuckDuckGo/Tab/Model/Tab+UIDelegate.swift index c87cd89b93..038e9104bf 100644 --- a/DuckDuckGo/Tab/Model/Tab+UIDelegate.swift +++ b/DuckDuckGo/Tab/Model/Tab+UIDelegate.swift @@ -1,5 +1,5 @@ // -// TabUIDelegate.swift +// Tab+UIDelegate.swift // // Copyright © 2022 DuckDuckGo. All rights reserved. // diff --git a/DuckDuckGo/Tab/UserScripts/UserScripts.swift b/DuckDuckGo/Tab/UserScripts/UserScripts.swift index e157281706..88160621f0 100644 --- a/DuckDuckGo/Tab/UserScripts/UserScripts.swift +++ b/DuckDuckGo/Tab/UserScripts/UserScripts.swift @@ -52,7 +52,7 @@ final class UserScripts: UserScriptsProvider { let privacySettings = PrivacySecurityPreferences.shared let privacyConfig = sourceProvider.privacyConfigurationManager.privacyConfig let sessionKey = sourceProvider.sessionKey ?? "" - let prefs = ContentScopeProperties.init(gpcEnabled: privacySettings.gpcEnabled, + let prefs = ContentScopeProperties(gpcEnabled: privacySettings.gpcEnabled, sessionKey: sessionKey, featureToggles: ContentScopeFeatureToggles.supportedFeaturesOnMacOS(privacyConfig)) contentScopeUserScript = ContentScopeUserScript(sourceProvider.privacyConfigurationManager, properties: prefs) diff --git a/DuckDuckGo/Waitlist/Views/WaitlistRootView.swift b/DuckDuckGo/Waitlist/Views/WaitlistRootView.swift index a2d34a601b..d4cd80abd5 100644 --- a/DuckDuckGo/Waitlist/Views/WaitlistRootView.swift +++ b/DuckDuckGo/Waitlist/Views/WaitlistRootView.swift @@ -1,5 +1,5 @@ // -// NetworkProtectionWaitlistRootView.swift +// WaitlistRootView.swift // // Copyright © 2023 DuckDuckGo. All rights reserved. // diff --git a/DuckDuckGo/YoutubePlayer/DuckPlayerURLExtension.swift b/DuckDuckGo/YoutubePlayer/DuckPlayerURLExtension.swift index 0cbefc285f..abd7875078 100644 --- a/DuckDuckGo/YoutubePlayer/DuckPlayerURLExtension.swift +++ b/DuckDuckGo/YoutubePlayer/DuckPlayerURLExtension.swift @@ -142,7 +142,7 @@ extension URL { private func addingTimestamp(_ timestamp: String?) -> URL { guard let timestamp = timestamp, - let regex = try? NSRegularExpression.init(pattern: "^(\\d+[smh]?)+$"), + let regex = try? NSRegularExpression(pattern: "^(\\d+[smh]?)+$"), timestamp.matches(regex) else { return self diff --git a/DuckDuckGoDBPBackgroundAgent/DataBrokerProtectionBackgroundManager.swift b/DuckDuckGoDBPBackgroundAgent/DataBrokerProtectionBackgroundManager.swift index 306f6b8b8e..526288a62c 100644 --- a/DuckDuckGoDBPBackgroundAgent/DataBrokerProtectionBackgroundManager.swift +++ b/DuckDuckGoDBPBackgroundAgent/DataBrokerProtectionBackgroundManager.swift @@ -1,5 +1,5 @@ // -// DataBrokerProtectionManager.swift +// DataBrokerProtectionBackgroundManager.swift // // Copyright © 2023 DuckDuckGo. All rights reserved. // @@ -52,7 +52,7 @@ public final class DataBrokerProtectionBackgroundManager { thirdPartyCredentialsProvider: false) let sessionKey = UUID().uuidString - let prefs = ContentScopeProperties.init(gpcEnabled: false, + let prefs = ContentScopeProperties(gpcEnabled: false, sessionKey: sessionKey, featureToggles: features) diff --git a/DuckDuckGoDBPBackgroundAgent/DuckDuckGoDBPBackgroundAgentAppDelegate.swift b/DuckDuckGoDBPBackgroundAgent/DuckDuckGoDBPBackgroundAgentAppDelegate.swift index 897d97d7ee..f2ac32192a 100644 --- a/DuckDuckGoDBPBackgroundAgent/DuckDuckGoDBPBackgroundAgentAppDelegate.swift +++ b/DuckDuckGoDBPBackgroundAgent/DuckDuckGoDBPBackgroundAgentAppDelegate.swift @@ -1,5 +1,5 @@ // -// DuckDuckGoAgentAppDelegate.swift +// DuckDuckGoDBPBackgroundAgentAppDelegate.swift // // Copyright © 2023 DuckDuckGo. All rights reserved. // diff --git a/IntegrationTests/.swiftlint.yml b/IntegrationTests/.swiftlint.yml new file mode 100644 index 0000000000..bf8a5655d9 --- /dev/null +++ b/IntegrationTests/.swiftlint.yml @@ -0,0 +1,17 @@ +disabled_rules: + - file_length + - unused_closure_parameter + - type_name + - force_cast + - force_try + - function_body_length + - cyclomatic_complexity + - identifier_name + - blanket_disable_command + - type_body_length + - explicit_non_final_class + - enforce_os_log_wrapper + +large_tuple: + warning: 6 + error: 10 diff --git a/IntegrationTests/SecurityTests/AddressBarSpoofingIntegrationTests.swift b/IntegrationTests/SecurityTests/AddressBarSpoofingIntegrationTests.swift index 05ee4f9681..f0bba6cf98 100644 --- a/IntegrationTests/SecurityTests/AddressBarSpoofingIntegrationTests.swift +++ b/IntegrationTests/SecurityTests/AddressBarSpoofingIntegrationTests.swift @@ -1,5 +1,5 @@ // -// NavigationProtectionIntegrationTests.swift +// AddressBarSpoofingIntegrationTests.swift // // Copyright © 2023 DuckDuckGo. All rights reserved. // diff --git a/LocalPackages/Account/Package.swift b/LocalPackages/Account/Package.swift index 0e357ade93..ac89713bde 100644 --- a/LocalPackages/Account/Package.swift +++ b/LocalPackages/Account/Package.swift @@ -12,7 +12,7 @@ let package = Package( targets: ["Account"]), ], dependencies: [ - .package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "94.0.2"), + .package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "94.0.3"), .package(path: "../Purchase") ], targets: [ @@ -21,9 +21,16 @@ let package = Package( dependencies: [ .product(name: "BrowserServicesKit", package: "BrowserServicesKit"), .product(name: "Purchase", package: "Purchase") - ]), + ], + swiftSettings: [ + .define("DEBUG", .when(configuration: .debug)) + ], + plugins: [.plugin(name: "SwiftLintPlugin", package: "BrowserServicesKit")] + ), .testTarget( name: "AccountTests", - dependencies: ["Account"]), + dependencies: ["Account"], + plugins: [.plugin(name: "SwiftLintPlugin", package: "BrowserServicesKit")] + ), ] ) diff --git a/LocalPackages/Account/Sources/Account/AuthService.swift b/LocalPackages/Account/Sources/Account/AuthService.swift index eaedf386e8..616451dec1 100644 --- a/LocalPackages/Account/Sources/Account/AuthService.swift +++ b/LocalPackages/Account/Sources/Account/AuthService.swift @@ -52,7 +52,6 @@ public struct AuthService { await executeAPICall(method: "GET", endpoint: "validate-token", headers: makeAuthorizationHeader(for: accessToken)) } - // swiftlint:disable nesting public struct ValidateTokenResponse: Decodable { public let account: Account @@ -72,7 +71,6 @@ public struct AuthService { let product: String } } - // swiftlint:enable nesting // MARK: - diff --git a/LocalPackages/Account/Tests/AccountTests/AccountsTests.swift b/LocalPackages/Account/Tests/AccountTests/AccountsTests.swift index 09f797525f..a34e6849f8 100644 --- a/LocalPackages/Account/Tests/AccountTests/AccountsTests.swift +++ b/LocalPackages/Account/Tests/AccountTests/AccountsTests.swift @@ -1,5 +1,5 @@ // -// AccountTests.swift +// AccountsTests.swift // // Copyright © 2023 DuckDuckGo. All rights reserved. // diff --git a/LocalPackages/BuildToolPlugins/Plugins/InputFilesChecker/Errors.swift b/LocalPackages/BuildToolPlugins/Plugins/InputFilesChecker/Errors.swift index e6badea5c7..8ae40f2703 100644 --- a/LocalPackages/BuildToolPlugins/Plugins/InputFilesChecker/Errors.swift +++ b/LocalPackages/BuildToolPlugins/Plugins/InputFilesChecker/Errors.swift @@ -1,5 +1,5 @@ // -// TargetSourcesChecker.swift +// Errors.swift // // Copyright © 2022 DuckDuckGo. All rights reserved. // diff --git a/LocalPackages/BuildToolPlugins/Plugins/InputFilesChecker/InputFilesChecker.swift b/LocalPackages/BuildToolPlugins/Plugins/InputFilesChecker/InputFilesChecker.swift index 93200ad388..ad2b491fc6 100644 --- a/LocalPackages/BuildToolPlugins/Plugins/InputFilesChecker/InputFilesChecker.swift +++ b/LocalPackages/BuildToolPlugins/Plugins/InputFilesChecker/InputFilesChecker.swift @@ -1,5 +1,5 @@ // -// TargetSourcesChecker.swift +// InputFilesChecker.swift // // Copyright © 2022 DuckDuckGo. All rights reserved. // diff --git a/LocalPackages/DataBrokerProtection/Package.swift b/LocalPackages/DataBrokerProtection/Package.swift index d5c101fa40..4ae4836f76 100644 --- a/LocalPackages/DataBrokerProtection/Package.swift +++ b/LocalPackages/DataBrokerProtection/Package.swift @@ -29,7 +29,7 @@ let package = Package( targets: ["DataBrokerProtection"]) ], dependencies: [ - .package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "94.0.2"), + .package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "94.0.3"), .package(path: "../PixelKit"), .package(path: "../SwiftUIExtensions"), .package(path: "../XPCHelper") @@ -43,13 +43,19 @@ let package = Package( .product(name: "SwiftUIExtensions", package: "SwiftUIExtensions"), .byName(name: "XPCHelper") ], - resources: [.process("Resources")] + resources: [.process("Resources")], + swiftSettings: [ + .define("DEBUG", .when(configuration: .debug)) + ], + plugins: [.plugin(name: "SwiftLintPlugin", package: "BrowserServicesKit")] ), .testTarget( name: "DataBrokerProtectionTests", dependencies: [ "DataBrokerProtection", "BrowserServicesKit" - ]) + ], + plugins: [.plugin(name: "SwiftLintPlugin", package: "BrowserServicesKit")] + ) ] ) diff --git a/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/DebugUI/DataBrokerDatabaseBrowserView.swift b/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/DebugUI/DataBrokerDatabaseBrowserView.swift index f3b93bc067..18b5ffa6b6 100644 --- a/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/DebugUI/DataBrokerDatabaseBrowserView.swift +++ b/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/DebugUI/DataBrokerDatabaseBrowserView.swift @@ -1,5 +1,5 @@ // -// DataBrokerDataBaseBrowserView.swift +// DataBrokerDatabaseBrowserView.swift // // Copyright © 2023 DuckDuckGo. All rights reserved. // diff --git a/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/IPC/DataBrokerProtectionIPCServer.swift b/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/IPC/DataBrokerProtectionIPCServer.swift index b0527a88e0..fde0274a5f 100644 --- a/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/IPC/DataBrokerProtectionIPCServer.swift +++ b/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/IPC/DataBrokerProtectionIPCServer.swift @@ -1,5 +1,5 @@ // -// TunnelControllerIPCServer.swift +// DataBrokerProtectionIPCServer.swift // // Copyright © 2023 DuckDuckGo. All rights reserved. // diff --git a/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Model/Actions/Navigate.swift b/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Model/Actions/Navigate.swift index 79b086c1d7..03dd465d80 100644 --- a/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Model/Actions/Navigate.swift +++ b/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Model/Actions/Navigate.swift @@ -1,5 +1,5 @@ // -// NavigateAction.swift +// Navigate.swift // // Copyright © 2023 DuckDuckGo. All rights reserved. // diff --git a/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Model/DBPUIViewModel.swift b/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Model/DBPUIViewModel.swift index 4755a77db9..ef1db86240 100644 --- a/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Model/DBPUIViewModel.swift +++ b/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Model/DBPUIViewModel.swift @@ -1,5 +1,5 @@ // -// DataBrokerProtectionViewController.swift +// DBPUIViewModel.swift // // Copyright © 2023 DuckDuckGo. All rights reserved. // diff --git a/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Operations/DataBrokerOperationRunner.swift b/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Operations/DataBrokerOperationRunner.swift index 936965db50..b15e7e0791 100644 --- a/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Operations/DataBrokerOperationRunner.swift +++ b/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Operations/DataBrokerOperationRunner.swift @@ -1,5 +1,5 @@ // -// WebOperationRunner.swift +// DataBrokerOperationRunner.swift // // Copyright © 2023 DuckDuckGo. All rights reserved. // diff --git a/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Operations/DataBrokerProtectionBrokerUpdater.swift b/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Operations/DataBrokerProtectionBrokerUpdater.swift index 5237ff1846..667890c3d0 100644 --- a/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Operations/DataBrokerProtectionBrokerUpdater.swift +++ b/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Operations/DataBrokerProtectionBrokerUpdater.swift @@ -1,5 +1,5 @@ // -// DataBrokerProtectionUpdater.swift +// DataBrokerProtectionBrokerUpdater.swift // // Copyright © 2023 DuckDuckGo. All rights reserved. // diff --git a/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Scheduler/DataBrokerProtectionNoOpScheduler.swift b/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Scheduler/DataBrokerProtectionNoOpScheduler.swift index 23e564a2c7..98c06019ff 100644 --- a/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Scheduler/DataBrokerProtectionNoOpScheduler.swift +++ b/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Scheduler/DataBrokerProtectionNoOpScheduler.swift @@ -1,5 +1,5 @@ // -// SwiftUIPreviewHelper.swift +// DataBrokerProtectionNoOpScheduler.swift // // Copyright © 2023 DuckDuckGo. All rights reserved. // diff --git a/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Services/EmailService.swift b/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Services/EmailService.swift index 583df33524..2b39f10569 100644 --- a/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Services/EmailService.swift +++ b/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Services/EmailService.swift @@ -1,5 +1,5 @@ // -// DataBrokerProtectionEmailService.swift +// EmailService.swift // // Copyright © 2023 DuckDuckGo. All rights reserved. // diff --git a/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Services/RedeemCodeServices.swift b/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Services/RedeemCodeServices.swift index ae15ce650c..be4e47320c 100644 --- a/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Services/RedeemCodeServices.swift +++ b/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Services/RedeemCodeServices.swift @@ -1,5 +1,5 @@ // -// ReedemCodeServices.swift +// RedeemCodeServices.swift // // Copyright © 2023 DuckDuckGo. All rights reserved. // diff --git a/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/UI/DataBrokerProtectionWebUIURLSettings.swift b/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/UI/DataBrokerProtectionWebUIURLSettings.swift index d85575ed40..e7f84b0657 100644 --- a/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/UI/DataBrokerProtectionWebUIURLSettings.swift +++ b/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/UI/DataBrokerProtectionWebUIURLSettings.swift @@ -1,5 +1,5 @@ // -// DBPUICommunicationLayer.swift +// DataBrokerProtectionWebUIURLSettings.swift // // Copyright © 2023 DuckDuckGo. All rights reserved. // diff --git a/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/UI/InviteCodeFlow/DataBrokerProtectionInviteCodeViewModels.swift b/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/UI/InviteCodeFlow/DataBrokerProtectionInviteCodeViewModels.swift index a59110cd64..18d538532e 100644 --- a/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/UI/InviteCodeFlow/DataBrokerProtectionInviteCodeViewModels.swift +++ b/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/UI/InviteCodeFlow/DataBrokerProtectionInviteCodeViewModels.swift @@ -1,5 +1,5 @@ // -// DataBrokerProtectionInviteCodeView.swift +// DataBrokerProtectionInviteCodeViewModels.swift // // Copyright © 2023 DuckDuckGo. All rights reserved. // diff --git a/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/UI/InviteCodeFlow/DataBrokerProtectionInviteDialogsView.swift b/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/UI/InviteCodeFlow/DataBrokerProtectionInviteDialogsView.swift index 3634b34dcf..58c47086d1 100644 --- a/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/UI/InviteCodeFlow/DataBrokerProtectionInviteDialogsView.swift +++ b/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/UI/InviteCodeFlow/DataBrokerProtectionInviteDialogsView.swift @@ -1,5 +1,5 @@ // -// DataBrokerProtectionInviteCodeView.swift +// DataBrokerProtectionInviteDialogsView.swift // // Copyright © 2023 DuckDuckGo. All rights reserved. // diff --git a/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/UI/UIMapper.swift b/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/UI/UIMapper.swift index 1b37f90407..836bd52a30 100644 --- a/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/UI/UIMapper.swift +++ b/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/UI/UIMapper.swift @@ -51,7 +51,7 @@ struct MapperToUI { func initialScanState(_ brokerProfileQueryData: [BrokerProfileQueryData]) -> DBPUIInitialScanState { // Total and current scans are misleading. The UI are counting this per broker and // not by the total real cans that the app is doing. - let profileQueriesGroupedByBroker = Dictionary.init(grouping: brokerProfileQueryData, by: { $0.dataBroker.name }) + let profileQueriesGroupedByBroker = Dictionary(grouping: brokerProfileQueryData, by: { $0.dataBroker.name }) let totalScans = profileQueriesGroupedByBroker.reduce(0) { accumulator, element in return accumulator + element.value.totalScans @@ -93,7 +93,7 @@ struct MapperToUI { var removedProfiles = [DBPUIDataBrokerProfileMatch]() let scansThatRanAtLeastOnce = brokerProfileQueryData.flatMap { $0.sitesScanned } - let sitesScanned = Dictionary.init(grouping: scansThatRanAtLeastOnce, by: { $0 }).count + let sitesScanned = Dictionary(grouping: scansThatRanAtLeastOnce, by: { $0 }).count brokerProfileQueryData.forEach { let dataBroker = $0.dataBroker @@ -123,7 +123,7 @@ struct MapperToUI { } } - let completedOptOutsDictionary = Dictionary.init(grouping: removedProfiles, by: { $0.dataBroker }) + let completedOptOutsDictionary = Dictionary(grouping: removedProfiles, by: { $0.dataBroker }) let completedOptOuts = completedOptOutsDictionary.map { (key: DBPUIDataBroker, value: [DBPUIDataBrokerProfileMatch]) in DBPUIOptOutMatch(dataBroker: key, matches: value.count) } @@ -141,7 +141,7 @@ struct MapperToUI { private func getLastScanInformation(brokerProfileQueryData: [BrokerProfileQueryData], currentDate: Date = Date(), format: String = "dd/MM/yyyy") -> DBUIScanDate { - let scansGroupedByLastRunDate = Dictionary.init(grouping: brokerProfileQueryData, by: { $0.scanOperationData.lastRunDate?.toFormat(format) }) + let scansGroupedByLastRunDate = Dictionary(grouping: brokerProfileQueryData, by: { $0.scanOperationData.lastRunDate?.toFormat(format) }) let closestScansBeforeToday = scansGroupedByLastRunDate .filter { $0.key != nil && $0.key!.toDate(using: format) < currentDate } .sorted { $0.key! < $1.key! } @@ -154,7 +154,7 @@ struct MapperToUI { private func getNextScansInformation(brokerProfileQueryData: [BrokerProfileQueryData], currentDate: Date = Date(), format: String = "dd/MM/yyyy") -> DBUIScanDate { - let scansGroupedByPreferredRunDate = Dictionary.init(grouping: brokerProfileQueryData, by: { $0.scanOperationData.preferredRunDate?.toFormat(format) }) + let scansGroupedByPreferredRunDate = Dictionary(grouping: brokerProfileQueryData, by: { $0.scanOperationData.preferredRunDate?.toFormat(format) }) let closestScansAfterToday = scansGroupedByPreferredRunDate .filter { $0.key != nil && $0.key!.toDate(using: format) > currentDate } .sorted { $0.key! < $1.key! } diff --git a/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Utils/CodableExtension.swift b/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Utils/CodableExtension.swift index 2bc7022912..46cc1e4a56 100644 --- a/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Utils/CodableExtension.swift +++ b/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Utils/CodableExtension.swift @@ -1,5 +1,5 @@ // -// CodableExtensions.swift +// CodableExtension.swift // // Copyright © 2023 DuckDuckGo. All rights reserved. // diff --git a/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Utils/DataBrokerProtectionNotifications.swift b/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Utils/DataBrokerProtectionNotifications.swift index 65089411ba..0aae115724 100644 --- a/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Utils/DataBrokerProtectionNotifications.swift +++ b/LocalPackages/DataBrokerProtection/Sources/DataBrokerProtection/Utils/DataBrokerProtectionNotifications.swift @@ -1,5 +1,5 @@ // -// DataBrokerNotifications.swift +// DataBrokerProtectionNotifications.swift // // Copyright © 2023 DuckDuckGo. All rights reserved. // diff --git a/LocalPackages/DataBrokerProtection/Tests/DataBrokerProtectionTests/DataBrokerProfileQueryOperationManagerTests.swift b/LocalPackages/DataBrokerProtection/Tests/DataBrokerProtectionTests/DataBrokerProfileQueryOperationManagerTests.swift index 08c6eb5e00..bef3c21452 100644 --- a/LocalPackages/DataBrokerProtection/Tests/DataBrokerProtectionTests/DataBrokerProfileQueryOperationManagerTests.swift +++ b/LocalPackages/DataBrokerProtection/Tests/DataBrokerProtectionTests/DataBrokerProfileQueryOperationManagerTests.swift @@ -1,5 +1,5 @@ // -// OperationsTests.swift +// DataBrokerProfileQueryOperationManagerTests.swift // // Copyright © 2023 DuckDuckGo. All rights reserved. // diff --git a/LocalPackages/LoginItems/Package.swift b/LocalPackages/LoginItems/Package.swift index dc73fdf5d3..812799c709 100644 --- a/LocalPackages/LoginItems/Package.swift +++ b/LocalPackages/LoginItems/Package.swift @@ -9,12 +9,20 @@ let package = Package( products: [ .library( name: "LoginItems", - targets: ["LoginItems"]), + targets: ["LoginItems"] + ), + ], + dependencies: [ + .package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "94.0.3"), ], - dependencies: [], targets: [ .target( name: "LoginItems", - dependencies: []), + dependencies: [], + swiftSettings: [ + .define("DEBUG", .when(configuration: .debug)) + ], + plugins: [.plugin(name: "SwiftLintPlugin", package: "BrowserServicesKit")] + ), ] ) diff --git a/LocalPackages/NetworkProtectionMac/Package.swift b/LocalPackages/NetworkProtectionMac/Package.swift index 99ead44dd0..8ca1026715 100644 --- a/LocalPackages/NetworkProtectionMac/Package.swift +++ b/LocalPackages/NetworkProtectionMac/Package.swift @@ -30,7 +30,7 @@ let package = Package( .library(name: "NetworkProtectionUI", targets: ["NetworkProtectionUI"]) ], dependencies: [ - .package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "94.0.2"), + .package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "94.0.3"), .package(path: "../XPCHelper"), .package(path: "../SwiftUIExtensions") ], @@ -42,7 +42,12 @@ let package = Package( dependencies: [ .product(name: "NetworkProtection", package: "BrowserServicesKit"), .product(name: "XPCHelper", package: "XPCHelper") - ]), + ], + swiftSettings: [ + .define("DEBUG", .when(configuration: .debug)) + ], + plugins: [.plugin(name: "SwiftLintPlugin", package: "BrowserServicesKit")] + ), // MARK: - NetworkProtectionUI @@ -54,12 +59,19 @@ let package = Package( ], resources: [ .copy("Resources/Assets.xcassets") - ]), + ], + swiftSettings: [ + .define("DEBUG", .when(configuration: .debug)) + ], + plugins: [.plugin(name: "SwiftLintPlugin", package: "BrowserServicesKit")] + ), .testTarget( name: "NetworkProtectionUITests", dependencies: [ "NetworkProtectionUI", .product(name: "NetworkProtectionTestUtils", package: "BrowserServicesKit") - ]) + ], + plugins: [.plugin(name: "SwiftLintPlugin", package: "BrowserServicesKit")] + ) ] ) diff --git a/LocalPackages/NetworkProtectionMac/Sources/NetworkProtectionUI/Extensions/UserText+NetworkProtectionUI.swift b/LocalPackages/NetworkProtectionMac/Sources/NetworkProtectionUI/Extensions/UserText+NetworkProtectionUI.swift index a73363a9c8..0e12f133ce 100644 --- a/LocalPackages/NetworkProtectionMac/Sources/NetworkProtectionUI/Extensions/UserText+NetworkProtectionUI.swift +++ b/LocalPackages/NetworkProtectionMac/Sources/NetworkProtectionUI/Extensions/UserText+NetworkProtectionUI.swift @@ -1,5 +1,5 @@ // -// UserText.swift +// UserText+NetworkProtectionUI.swift // // Copyright © 2022 DuckDuckGo. All rights reserved. // diff --git a/LocalPackages/NetworkProtectionMac/Sources/NetworkProtectionUI/Views/TunnelControllerView/TunnelControllerView.swift b/LocalPackages/NetworkProtectionMac/Sources/NetworkProtectionUI/Views/TunnelControllerView/TunnelControllerView.swift index f7b0286ef6..2101c704da 100644 --- a/LocalPackages/NetworkProtectionMac/Sources/NetworkProtectionUI/Views/TunnelControllerView/TunnelControllerView.swift +++ b/LocalPackages/NetworkProtectionMac/Sources/NetworkProtectionUI/Views/TunnelControllerView/TunnelControllerView.swift @@ -1,5 +1,5 @@ // -// NetworkProtectionStatusView.swift +// TunnelControllerView.swift // // Copyright © 2022 DuckDuckGo. All rights reserved. // diff --git a/LocalPackages/NetworkProtectionMac/Tests/NetworkProtectionUITests/NetworkProtectionAssetTests.swift b/LocalPackages/NetworkProtectionMac/Tests/NetworkProtectionUITests/NetworkProtectionAssetTests.swift index 07915bd363..7386c27aff 100644 --- a/LocalPackages/NetworkProtectionMac/Tests/NetworkProtectionUITests/NetworkProtectionAssetTests.swift +++ b/LocalPackages/NetworkProtectionMac/Tests/NetworkProtectionUITests/NetworkProtectionAssetTests.swift @@ -1,5 +1,5 @@ // -// NetworkProtectionAssetsTests.swift +// NetworkProtectionAssetTests.swift // // Copyright © 2023 DuckDuckGo. All rights reserved. // diff --git a/LocalPackages/PixelKit/Package.swift b/LocalPackages/PixelKit/Package.swift index 4381539943..84d0ee7c05 100644 --- a/LocalPackages/PixelKit/Package.swift +++ b/LocalPackages/PixelKit/Package.swift @@ -12,25 +12,37 @@ let package = Package( // Products define the executables and libraries a package produces, and make them visible to other packages. .library( name: "PixelKit", - targets: ["PixelKit"]), + targets: ["PixelKit"] + ), .library( name: "PixelKitTestingUtilities", - targets: ["PixelKitTestingUtilities"]) + targets: ["PixelKitTestingUtilities"] + ) ], dependencies: [ + .package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "94.0.3"), ], targets: [ .target( name: "PixelKit", - dependencies: []), + dependencies: [], + swiftSettings: [ + .define("DEBUG", .when(configuration: .debug)) + ], + plugins: [.plugin(name: "SwiftLintPlugin", package: "BrowserServicesKit")] + ), .testTarget( name: "PixelKitTests", dependencies: ["PixelKit", "PixelKitTestingUtilities"], swiftSettings: [ .define("DEBUG", .when(configuration: .debug)) - ]), + ], + plugins: [.plugin(name: "SwiftLintPlugin", package: "BrowserServicesKit")] + ), .target( name: "PixelKitTestingUtilities", - dependencies: ["PixelKit"]) + dependencies: ["PixelKit"], + plugins: [.plugin(name: "SwiftLintPlugin", package: "BrowserServicesKit")] + ) ] ) diff --git a/LocalPackages/Purchase/Package.swift b/LocalPackages/Purchase/Package.swift index 90f52affc5..e285e512bf 100644 --- a/LocalPackages/Purchase/Package.swift +++ b/LocalPackages/Purchase/Package.swift @@ -9,16 +9,25 @@ let package = Package( products: [ .library( name: "Purchase", - targets: ["Purchase"]), + targets: ["Purchase"] + ), ], dependencies: [ + .package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "94.0.3"), ], targets: [ .target( name: "Purchase", - dependencies: []), + dependencies: [], + swiftSettings: [ + .define("DEBUG", .when(configuration: .debug)) + ], + plugins: [.plugin(name: "SwiftLintPlugin", package: "BrowserServicesKit")] + ), .testTarget( name: "PurchaseTests", - dependencies: ["Purchase"]), + dependencies: ["Purchase"], + plugins: [.plugin(name: "SwiftLintPlugin", package: "BrowserServicesKit")] + ), ] ) diff --git a/LocalPackages/Subscription/Package.swift b/LocalPackages/Subscription/Package.swift index 3ef881ba83..c2128fc6bb 100644 --- a/LocalPackages/Subscription/Package.swift +++ b/LocalPackages/Subscription/Package.swift @@ -14,7 +14,8 @@ let package = Package( dependencies: [ .package(path: "../Account"), .package(path: "../Purchase"), - .package(path: "../SwiftUIExtensions") + .package(path: "../SwiftUIExtensions"), + .package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "94.0.3"), ], targets: [ .target( @@ -26,9 +27,16 @@ let package = Package( ], resources: [ .process("Resources") - ]), + ], + swiftSettings: [ + .define("DEBUG", .when(configuration: .debug)) + ], + plugins: [.plugin(name: "SwiftLintPlugin", package: "BrowserServicesKit")] + ), .testTarget( name: "SubscriptionTests", - dependencies: ["Subscription"]), + dependencies: ["Subscription"], + plugins: [.plugin(name: "SwiftLintPlugin", package: "BrowserServicesKit")] + ), ] ) diff --git a/LocalPackages/Subscription/Sources/Subscription/DebugMenu/SubscriptionDebugMenu.swift b/LocalPackages/Subscription/Sources/Subscription/DebugMenu/SubscriptionDebugMenu.swift index ae2ddfe3ce..91a92d5c18 100644 --- a/LocalPackages/Subscription/Sources/Subscription/DebugMenu/SubscriptionDebugMenu.swift +++ b/LocalPackages/Subscription/Sources/Subscription/DebugMenu/SubscriptionDebugMenu.swift @@ -97,7 +97,7 @@ public final class SubscriptionDebugMenu: NSMenuItem { private func showAlert(title: String, message: String? = nil) { Task { @MainActor in - let alert = NSAlert.init() + let alert = NSAlert() alert.messageText = title if let message = message { alert.informativeText = message diff --git a/LocalPackages/SwiftUIExtensions/Package.swift b/LocalPackages/SwiftUIExtensions/Package.swift index cb737eef4d..39468594bf 100644 --- a/LocalPackages/SwiftUIExtensions/Package.swift +++ b/LocalPackages/SwiftUIExtensions/Package.swift @@ -9,12 +9,20 @@ let package = Package( products: [ .library( name: "SwiftUIExtensions", - targets: ["SwiftUIExtensions"]), + targets: ["SwiftUIExtensions"] + ), + ], + dependencies: [ + .package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "94.0.3"), ], - dependencies: [], targets: [ .target( name: "SwiftUIExtensions", - dependencies: []), + dependencies: [], + swiftSettings: [ + .define("DEBUG", .when(configuration: .debug)) + ], + plugins: [.plugin(name: "SwiftLintPlugin", package: "BrowserServicesKit")] + ), ] ) diff --git a/LocalPackages/SwiftUIExtensions/Sources/SwiftUIExtensions/LetterIconView.swift b/LocalPackages/SwiftUIExtensions/Sources/SwiftUIExtensions/LetterIconView.swift index 3c8203a7af..84cdc2a6ed 100644 --- a/LocalPackages/SwiftUIExtensions/Sources/SwiftUIExtensions/LetterIconView.swift +++ b/LocalPackages/SwiftUIExtensions/Sources/SwiftUIExtensions/LetterIconView.swift @@ -1,5 +1,5 @@ // -// FaviconLetterView.swift +// LetterIconView.swift // // Copyright © 2023 DuckDuckGo. All rights reserved. // diff --git a/LocalPackages/SwiftUIExtensions/Sources/SwiftUIExtensions/NativeCheckBoxToggle.swift b/LocalPackages/SwiftUIExtensions/Sources/SwiftUIExtensions/NativeCheckBoxToggle.swift index fa73a3082e..f5bb9d449d 100644 --- a/LocalPackages/SwiftUIExtensions/Sources/SwiftUIExtensions/NativeCheckBoxToggle.swift +++ b/LocalPackages/SwiftUIExtensions/Sources/SwiftUIExtensions/NativeCheckBoxToggle.swift @@ -1,5 +1,5 @@ // -// NativeCheckboxToggle.swift +// NativeCheckBoxToggle.swift // // Copyright © 2023 DuckDuckGo. All rights reserved. // diff --git a/LocalPackages/SwiftUIExtensions/Sources/SwiftUIExtensions/View+Link.swift b/LocalPackages/SwiftUIExtensions/Sources/SwiftUIExtensions/View+Link.swift index 498c1b7481..907643c980 100644 --- a/LocalPackages/SwiftUIExtensions/Sources/SwiftUIExtensions/View+Link.swift +++ b/LocalPackages/SwiftUIExtensions/Sources/SwiftUIExtensions/View+Link.swift @@ -1,5 +1,5 @@ // -// Link.swift +// View+Link.swift // // Copyright © 2021 DuckDuckGo. All rights reserved. // diff --git a/LocalPackages/SwiftUIExtensions/Sources/SwiftUIExtensions/View+Visibility.swift b/LocalPackages/SwiftUIExtensions/Sources/SwiftUIExtensions/View+Visibility.swift index 76f6c79236..f25fd1f86b 100644 --- a/LocalPackages/SwiftUIExtensions/Sources/SwiftUIExtensions/View+Visibility.swift +++ b/LocalPackages/SwiftUIExtensions/Sources/SwiftUIExtensions/View+Visibility.swift @@ -1,5 +1,5 @@ // -// ViewVisibility.swift +// View+Visibility.swift // // Copyright © 2021 DuckDuckGo. All rights reserved. // diff --git a/LocalPackages/SyncUI/Package.swift b/LocalPackages/SyncUI/Package.swift index a933085181..6b203f9013 100644 --- a/LocalPackages/SyncUI/Package.swift +++ b/LocalPackages/SyncUI/Package.swift @@ -12,16 +12,24 @@ let package = Package( targets: ["SyncUI"]), ], dependencies: [ - .package(path: "../SwiftUIExtensions") + .package(path: "../SwiftUIExtensions"), + .package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "94.0.3"), ], targets: [ .target( name: "SyncUI", dependencies: [ .product(name: "SwiftUIExtensions", package: "SwiftUIExtensions") - ]), + ], + swiftSettings: [ + .define("DEBUG", .when(configuration: .debug)) + ], + plugins: [.plugin(name: "SwiftLintPlugin", package: "BrowserServicesKit")] + ), .testTarget( name: "SyncUITests", - dependencies: ["SyncUI"]), + dependencies: ["SyncUI"], + plugins: [.plugin(name: "SwiftLintPlugin", package: "BrowserServicesKit")] + ), ] ) diff --git a/LocalPackages/SyncUI/Sources/SyncUI/Views/internal/QRCodeView.swift b/LocalPackages/SyncUI/Sources/SyncUI/Views/internal/QRCodeView.swift index 5eaaa40614..153cf9ae36 100644 --- a/LocalPackages/SyncUI/Sources/SyncUI/Views/internal/QRCodeView.swift +++ b/LocalPackages/SyncUI/Sources/SyncUI/Views/internal/QRCodeView.swift @@ -38,7 +38,7 @@ struct QRCode: View { return NSImage(systemSymbolName: "xmark.circle", accessibilityDescription: nil) ?? NSImage() }() let data = Data(text.utf8) - let qrCodeFilter: CIFilter = CIFilter.init(name: "CIQRCodeGenerator")! + let qrCodeFilter: CIFilter = CIFilter(name: "CIQRCodeGenerator")! qrCodeFilter.setValue(data, forKey: "inputMessage") qrCodeFilter.setValue("H", forKey: "inputCorrectionLevel") diff --git a/LocalPackages/SyncUI/Sources/SyncUI/Views/internal/SyncUIViews.swift b/LocalPackages/SyncUI/Sources/SyncUI/Views/internal/SyncUIViews.swift index 3bbca6f1bd..10e33ed47f 100644 --- a/LocalPackages/SyncUI/Sources/SyncUI/Views/internal/SyncUIViews.swift +++ b/LocalPackages/SyncUI/Sources/SyncUI/Views/internal/SyncUIViews.swift @@ -1,5 +1,5 @@ // -// SyncUIConstants.swift +// SyncUIViews.swift // // Copyright © 2023 DuckDuckGo. All rights reserved. // diff --git a/LocalPackages/SystemExtensionManager/Package.swift b/LocalPackages/SystemExtensionManager/Package.swift index cec75aa2e6..dad8deb3ce 100644 --- a/LocalPackages/SystemExtensionManager/Package.swift +++ b/LocalPackages/SystemExtensionManager/Package.swift @@ -12,12 +12,21 @@ let package = Package( // Products define the executables and libraries a package produces, making them visible to other packages. .library( name: "SystemExtensionManager", - targets: ["SystemExtensionManager"]), + targets: ["SystemExtensionManager"] + ), + ], + dependencies: [ + .package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "94.0.3"), ], targets: [ // Targets are the basic building blocks of a package, defining a module or a test suite. // Targets can depend on other targets in this package and products from dependencies. .target( - name: "SystemExtensionManager") + name: "SystemExtensionManager", + swiftSettings: [ + .define("DEBUG", .when(configuration: .debug)) + ], + plugins: [.plugin(name: "SwiftLintPlugin", package: "BrowserServicesKit")] + ) ] ) diff --git a/LocalPackages/XPCHelper/Package.swift b/LocalPackages/XPCHelper/Package.swift index 5eef7930ba..8fb7f222ba 100644 --- a/LocalPackages/XPCHelper/Package.swift +++ b/LocalPackages/XPCHelper/Package.swift @@ -30,14 +30,18 @@ let package = Package( .library(name: "XPCHelper", targets: ["XPCHelper"]), ], dependencies: [ - // Dependencies declare other packages that this package depends on. - // .package(url: /* package url */, from: "1.0.0"), + .package(url: "https://github.com/duckduckgo/BrowserServicesKit", exact: "94.0.3"), ], targets: [ // Targets are the basic building blocks of a package. A target can define a module or a test suite. // Targets can depend on other targets in this package, and on products in packages this package depends on. .target( name: "XPCHelper", - dependencies: []) + dependencies: [], + swiftSettings: [ + .define("DEBUG", .when(configuration: .debug)) + ], + plugins: [.plugin(name: "SwiftLintPlugin", package: "BrowserServicesKit")] + ) ] ) diff --git a/NetworkProtectionSystemExtension/NetworkProtectionAgentNotificationsPresenter.swift b/NetworkProtectionSystemExtension/NetworkProtectionAgentNotificationsPresenter.swift index 970a73bf55..37bee8c52e 100644 --- a/NetworkProtectionSystemExtension/NetworkProtectionAgentNotificationsPresenter.swift +++ b/NetworkProtectionSystemExtension/NetworkProtectionAgentNotificationsPresenter.swift @@ -1,5 +1,5 @@ // -// NetworkProtectionIPCNotificationsPresenter.swift +// NetworkProtectionAgentNotificationsPresenter.swift // // Copyright © 2023 DuckDuckGo. All rights reserved. // diff --git a/UITests/.swiftlint.yml b/UITests/.swiftlint.yml new file mode 100644 index 0000000000..bf8a5655d9 --- /dev/null +++ b/UITests/.swiftlint.yml @@ -0,0 +1,17 @@ +disabled_rules: + - file_length + - unused_closure_parameter + - type_name + - force_cast + - force_try + - function_body_length + - cyclomatic_complexity + - identifier_name + - blanket_disable_command + - type_body_length + - explicit_non_final_class + - enforce_os_log_wrapper + +large_tuple: + warning: 6 + error: 10 diff --git a/UnitTests/.swiftlint.yml b/UnitTests/.swiftlint.yml new file mode 100644 index 0000000000..bf8a5655d9 --- /dev/null +++ b/UnitTests/.swiftlint.yml @@ -0,0 +1,17 @@ +disabled_rules: + - file_length + - unused_closure_parameter + - type_name + - force_cast + - force_try + - function_body_length + - cyclomatic_complexity + - identifier_name + - blanket_disable_command + - type_body_length + - explicit_non_final_class + - enforce_os_log_wrapper + +large_tuple: + warning: 6 + error: 10 diff --git a/UnitTests/Bookmarks/Model/BookmarkNodeTests.swift b/UnitTests/Bookmarks/Model/BookmarkNodeTests.swift index 7290746122..8a9060c2f9 100644 --- a/UnitTests/Bookmarks/Model/BookmarkNodeTests.swift +++ b/UnitTests/Bookmarks/Model/BookmarkNodeTests.swift @@ -112,7 +112,7 @@ class BookmarkNodeTests: XCTestCase { let rootNode = BookmarkNode(representedObject: TestObject(), parent: nil) let indexPath = rootNode.indexPath - XCTAssertEqual(indexPath, IndexPath.init(index: 0)) + XCTAssertEqual(indexPath, IndexPath(index: 0)) } func testWhenGettingIndexPath_AndNodeIsChild_ThenChildIndexPathIsReturned() { diff --git a/UnitTests/Common/Extensions/HTTPCookieTests.swift b/UnitTests/Common/Extensions/HTTPCookieTests.swift index e781001670..e9865e64e7 100644 --- a/UnitTests/Common/Extensions/HTTPCookieTests.swift +++ b/UnitTests/Common/Extensions/HTTPCookieTests.swift @@ -23,7 +23,7 @@ class HTTPCookieTests: XCTestCase { func testCookieBelongsToETLDPlus1Domain() { // Case 1: Cookie domain and eTLD+1 domain are the same - var cookieProperties: [HTTPCookiePropertyKey : Any] = [ + var cookieProperties: [HTTPCookiePropertyKey: Any] = [ .domain: "example.com", .path: "/", .name: "TestCookie", diff --git a/UnitTests/Geolocation/CLLocationManagerMock.swift b/UnitTests/Geolocation/CLLocationManagerMock.swift index b110193dcc..bf61216d4f 100644 --- a/UnitTests/Geolocation/CLLocationManagerMock.swift +++ b/UnitTests/Geolocation/CLLocationManagerMock.swift @@ -46,7 +46,7 @@ final class CLLocationManagerMock: CLLocationManager { override init() { super.init() - selfRef = NSValue.init(nonretainedObject: self) + selfRef = NSValue(nonretainedObject: self) Self.instances.append(selfRef) } diff --git a/UnitTests/History/Services/HistoryStoringMock.swift b/UnitTests/History/Services/HistoryStoringMock.swift index 728a7cd082..8b98a3d1b9 100644 --- a/UnitTests/History/Services/HistoryStoringMock.swift +++ b/UnitTests/History/Services/HistoryStoringMock.swift @@ -76,6 +76,7 @@ final class HistoryStoringMock: HistoryStoring { saveCalled = true savedHistoryEntries.append(entry) for visit in entry.visits { + // swiftlint:disable:next legacy_random visit.identifier = URL(string: "x-coredata://FBEAB2C4-8C32-4F3F-B34F-B79F293CDADD/VisitManagedObject/\(arc4random())") } diff --git a/UnitTests/HomePage/ContinueSetUpModelTests.swift b/UnitTests/HomePage/ContinueSetUpModelTests.swift index d77780657f..5284c9d322 100644 --- a/UnitTests/HomePage/ContinueSetUpModelTests.swift +++ b/UnitTests/HomePage/ContinueSetUpModelTests.swift @@ -1,5 +1,5 @@ // -// SetUpModelTests.swift +// ContinueSetUpModelTests.swift // // Copyright © 2023 DuckDuckGo. All rights reserved. // diff --git a/UnitTests/HomePage/Mocks/CapturingDefaultBrowserProvider.swift b/UnitTests/HomePage/Mocks/CapturingDefaultBrowserProvider.swift index c04b91f017..9931c9de94 100644 --- a/UnitTests/HomePage/Mocks/CapturingDefaultBrowserProvider.swift +++ b/UnitTests/HomePage/Mocks/CapturingDefaultBrowserProvider.swift @@ -1,5 +1,5 @@ // -// File.swift +// CapturingDefaultBrowserProvider.swift // // Copyright © 2023 DuckDuckGo. All rights reserved. // diff --git a/UnitTests/NavigationBar/LocalPinningManagerTests.swift b/UnitTests/NavigationBar/LocalPinningManagerTests.swift index 5a9ba9dbd7..9c57966d62 100644 --- a/UnitTests/NavigationBar/LocalPinningManagerTests.swift +++ b/UnitTests/NavigationBar/LocalPinningManagerTests.swift @@ -1,5 +1,5 @@ // -// LocalPinningManager.swift +// LocalPinningManagerTests.swift // // Copyright © 2022 DuckDuckGo. All rights reserved. // diff --git a/UnitTests/PrivacyReferenceTests/FireproofingReferenceTests.swift b/UnitTests/PrivacyReferenceTests/FireproofingReferenceTests.swift index d84ce9e662..3f51d5d926 100644 --- a/UnitTests/PrivacyReferenceTests/FireproofingReferenceTests.swift +++ b/UnitTests/PrivacyReferenceTests/FireproofingReferenceTests.swift @@ -77,7 +77,7 @@ final class FireproofingReferenceTests: XCTestCase { return } - Task { @MainActor () -> Void in + Task { @MainActor in await dataStore.cookieStore?.setCookie(cookie) await webCacheManager.clear() diff --git a/UnitTests/SecureVault/PasswordManagementListSectionTests.swift b/UnitTests/SecureVault/PasswordManagementListSectionTests.swift index 3c48a31db6..d9163847b3 100644 --- a/UnitTests/SecureVault/PasswordManagementListSectionTests.swift +++ b/UnitTests/SecureVault/PasswordManagementListSectionTests.swift @@ -44,10 +44,6 @@ final class PasswordManagementListSectionTests: XCTestCase { login(named: "š") ] - override func setUp() { - super.setUp() - } - func testWhenSortingEmptyArray_ThenNoSectionsAreReturned() { let sections = PasswordManagementListSection.sections(with: [], by: \.id, order: .ascending) XCTAssertTrue(sections.isEmpty) diff --git a/UnitTests/Statistics/PixelExperiment/PixelExperimentTests.swift b/UnitTests/Statistics/PixelExperiment/PixelExperimentTests.swift index 17087494c3..e5ae9939a5 100644 --- a/UnitTests/Statistics/PixelExperiment/PixelExperimentTests.swift +++ b/UnitTests/Statistics/PixelExperiment/PixelExperimentTests.swift @@ -1,5 +1,5 @@ // -// PixelTests.swift +// PixelExperimentTests.swift // // Copyright © 2023 DuckDuckGo. All rights reserved. // diff --git a/UnitTests/TabBar/ViewModel/TabLazyLoaderTests.swift b/UnitTests/TabBar/ViewModel/TabLazyLoaderTests.swift index d3dcc9ab21..d4ea051d82 100644 --- a/UnitTests/TabBar/ViewModel/TabLazyLoaderTests.swift +++ b/UnitTests/TabBar/ViewModel/TabLazyLoaderTests.swift @@ -150,8 +150,8 @@ class TabLazyLoaderTests: XCTestCase { dataSource.tabs = [ .mockNotUrl, - TabMock.init(isUrl: true, reloadExpectation: reloadExpectation), - TabMock.init(isUrl: true, reloadExpectation: reloadExpectation) + TabMock(isUrl: true, reloadExpectation: reloadExpectation), + TabMock(isUrl: true, reloadExpectation: reloadExpectation) ] dataSource.selectedTab = dataSource.tabs.first @@ -177,8 +177,8 @@ class TabLazyLoaderTests: XCTestCase { dataSource.tabs = [ selectedUrlTab, - TabMock.init(isUrl: true, reloadExpectation: reloadExpectation), - TabMock.init(isUrl: true, reloadExpectation: reloadExpectation) + TabMock(isUrl: true, reloadExpectation: reloadExpectation), + TabMock(isUrl: true, reloadExpectation: reloadExpectation) ] dataSource.selectedTab = dataSource.tabs.first @@ -203,8 +203,8 @@ class TabLazyLoaderTests: XCTestCase { dataSource.tabs = [ .mockUrl, - TabMock.init(isUrl: true, reloadExpectation: reloadExpectation), - TabMock.init(isUrl: true, reloadExpectation: reloadExpectation) + TabMock(isUrl: true, reloadExpectation: reloadExpectation), + TabMock(isUrl: true, reloadExpectation: reloadExpectation) ] dataSource.selectedTab = dataSource.tabs.first @@ -228,7 +228,7 @@ class TabLazyLoaderTests: XCTestCase { dataSource.tabs = [.mockNotUrl] for _ in 0..<(2 * maxNumberOfLazyLoadedTabs) { - dataSource.tabs.append(TabMock.init(isUrl: true, reloadExpectation: reloadExpectation)) + dataSource.tabs.append(TabMock(isUrl: true, reloadExpectation: reloadExpectation)) } dataSource.selectedTab = dataSource.tabs.first @@ -254,11 +254,11 @@ class TabLazyLoaderTests: XCTestCase { dataSource.tabs = [ selectedUrlTab, - TabMock.init(isUrl: true, reloadExpectation: reloadExpectation), - TabMock.init(isUrl: true, reloadExpectation: reloadExpectation), - TabMock.init(isUrl: true, reloadExpectation: reloadExpectation), - TabMock.init(isUrl: true, reloadExpectation: reloadExpectation), - TabMock.init(isUrl: true, reloadExpectation: reloadExpectation) + TabMock(isUrl: true, reloadExpectation: reloadExpectation), + TabMock(isUrl: true, reloadExpectation: reloadExpectation), + TabMock(isUrl: true, reloadExpectation: reloadExpectation), + TabMock(isUrl: true, reloadExpectation: reloadExpectation), + TabMock(isUrl: true, reloadExpectation: reloadExpectation) ] dataSource.selectedTab = selectedUrlTab diff --git a/UnitTests/VPNFeedbackForm/VPNFeedbackFormViewModelTests.swift b/UnitTests/VPNFeedbackForm/VPNFeedbackFormViewModelTests.swift index e325cf4516..481742c4b6 100644 --- a/UnitTests/VPNFeedbackForm/VPNFeedbackFormViewModelTests.swift +++ b/UnitTests/VPNFeedbackForm/VPNFeedbackFormViewModelTests.swift @@ -26,7 +26,6 @@ final class VPNFeedbackFormViewModelTests: XCTestCase { func testWhenCreatingViewModel_ThenInitialStateIsFeedbackPending() throws { let collector = MockVPNMetadataCollector() let sender = MockVPNFeedbackSender() - let delegate = MockVPNFeedbackFormViewModelDelegate() let viewModel = VPNFeedbackFormViewModel(metadataCollector: collector, feedbackSender: sender) XCTAssertEqual(viewModel.viewState, .feedbackPending) @@ -36,7 +35,6 @@ final class VPNFeedbackFormViewModelTests: XCTestCase { func testWhenSendingFeedbackSucceeds_ThenFeedbackIsSent() async throws { let collector = MockVPNMetadataCollector() let sender = MockVPNFeedbackSender() - let delegate = MockVPNFeedbackFormViewModelDelegate() let viewModel = VPNFeedbackFormViewModel(metadataCollector: collector, feedbackSender: sender) let text = "Some feedback report text" viewModel.selectedFeedbackCategory = .unableToInstall @@ -52,7 +50,6 @@ final class VPNFeedbackFormViewModelTests: XCTestCase { func testWhenSendingFeedbackFails_ThenFeedbackIsNotSent() async throws { let collector = MockVPNMetadataCollector() let sender = MockVPNFeedbackSender() - let delegate = MockVPNFeedbackFormViewModelDelegate() let viewModel = VPNFeedbackFormViewModel(metadataCollector: collector, feedbackSender: sender) let text = "Some feedback report text" viewModel.selectedFeedbackCategory = .unableToInstall diff --git a/UnitTests/Waitlist/WaitlistViewModelTests.swift b/UnitTests/Waitlist/WaitlistViewModelTests.swift index 0f2ecdd9de..8c1319d92b 100644 --- a/UnitTests/Waitlist/WaitlistViewModelTests.swift +++ b/UnitTests/Waitlist/WaitlistViewModelTests.swift @@ -28,7 +28,7 @@ final class WaitlistViewModelTests: XCTestCase { @MainActor func testWhenTimestampIsNotPresent_ThenStateIsNotJoinedQueue() async { let request = MockWaitlistRequest.failure() - let storage = MockWaitlistStorage.init() + let storage = MockWaitlistStorage() let viewModel = WaitlistViewModel(waitlistRequest: request, waitlistStorage: storage, notificationService: MockNotificationService(), @@ -44,7 +44,7 @@ final class WaitlistViewModelTests: XCTestCase { @MainActor func testWhenTimestampIsPresentAndInviteCodeIsNil_ThenStateIsJoinedQueue() async { let request = MockWaitlistRequest.failure() - let storage = MockWaitlistStorage.init() + let storage = MockWaitlistStorage() storage.store(waitlistTimestamp: 12345) let notificationService = MockNotificationService(authorizationStatus: .authorized) @@ -63,7 +63,7 @@ final class WaitlistViewModelTests: XCTestCase { @MainActor func testWhenTimestampIsPresentAndInviteCodeIsPresent_ThenStateIsInvited() async { let request = MockWaitlistRequest.failure() - let storage = MockWaitlistStorage.init() + let storage = MockWaitlistStorage() storage.store(waitlistTimestamp: 12345) storage.store(waitlistToken: "token") storage.store(inviteCode: "ABCD1234") @@ -108,7 +108,7 @@ final class WaitlistViewModelTests: XCTestCase { @MainActor func testWhenAcceptingTermsAndConditions_ThenAuthTokenIsFetched_AndTermsAndConditionsAreMarkedAsAccepted() async { let request = MockWaitlistRequest.failure() - let storage = MockWaitlistStorage.init() + let storage = MockWaitlistStorage() storage.store(waitlistTimestamp: 12345) storage.store(waitlistToken: "token") storage.store(inviteCode: "ABCD1234") diff --git a/lint.sh b/lint.sh deleted file mode 100755 index 53bac4af79..0000000000 --- a/lint.sh +++ /dev/null @@ -1,57 +0,0 @@ -#!/bin/bash - -FIX=false - -if [[ "$1" == "--fix" ]]; then - FIX=true -fi - -if [[ "$CONFIGURATION" != "Debug" ]]; then - echo "Skipping SwiftLint run in non-debug build" - exit 0 -fi - -# Add brew into PATH -if [[ -f /opt/homebrew/bin/brew ]]; then - eval "$(/opt/homebrew/bin/brew shellenv)" -fi - -run_swiftlint_for_modified_files () { - TEST_FILES="" - CODE_FILES="" - - # collect staged and unstaged files and replace spaces in filenames with #001 - for FILE_NAME in $({ git diff --name-only & git diff --cached --name-only; } | tr ' ' '\001' | tr '\n ' ' ') - do - # collect .swift files separately for Unit Tests and Code Files - if [[ "${FILE_NAME##*.}" == "swift" ]]; then - # check if file exists (replacing back #001 with space) - if [ -f "`echo "${FILE_NAME}" | tr '\001' ' '`" ]; then - if [[ "$FILE_NAME" == *"Tests/"* ]]; then - TEST_FILES+=" \"${FILE_NAME}\"" - else - CODE_FILES+=" \"${FILE_NAME}\"" - fi - fi - fi - done - - SWIFTLINT_COMMAND="swiftlint lint" - if $FIX; then - SWIFTLINT_COMMAND="swiftlint lint --fix" - fi - - if [ -n "${CODE_FILES}" ]; then - # replace back #001 with space and feed to swiftlint - echo "${CODE_FILES}" | tr '\001' ' ' | xargs $SWIFTLINT_COMMAND - fi - if [ -n "${TEST_FILES}" ]; then - echo "${TEST_FILES}" | tr '\001' ' ' | xargs $SWIFTLINT_COMMAND --config .swiftlint.tests.yml - fi -} - -if ! command -v swiftlint &> /dev/null; then - echo "error: SwiftLint not installed. Install using \`brew install swiftlint\`" - exit 1 -fi -run_swiftlint_for_modified_files diff --git a/scripts/archive.sh b/scripts/archive.sh index b0e9b89e27..eacd115cb2 100755 --- a/scripts/archive.sh +++ b/scripts/archive.sh @@ -244,6 +244,7 @@ archive_and_export() { -configuration "${configuration}" \ -archivePath "${archive}" \ -derivedDataPath "${derived_data}" \ + -skipPackagePluginValidation \ MARKETING_VERSION="${app_version}" \ CURRENT_PROJECT_VERSION="${build_number}" \ RELEASE_PRODUCT_NAME_OVERRIDE=DuckDuckGo \ @@ -259,6 +260,7 @@ archive_and_export() { -exportPath "${workdir}" \ -exportOptionsPlist "${export_options_plist}" \ -configuration "${configuration}" \ + -skipPackagePluginValidation \ 2>&1 \ | ${log_formatter} } From 4448ea124ccf8d75aaf334864de9c3cc1df1bddb Mon Sep 17 00:00:00 2001 From: Sabrina Tardio <44158575+SabrinaTardio@users.noreply.github.com> Date: Mon, 18 Dec 2023 15:02:04 +0100 Subject: [PATCH 02/18] Sabrina/sync e2e tests (#1959) Task/Issue URL: https://app.asana.com/0/0/1206157806473025/f **Description**: Add e2e sync tests --- Configuration/UITests/SyncE2EUITests.xcconfig | 36 ++ .../UITests/SyncE2EUITestsAppStore.xcconfig | 36 ++ DuckDuckGo.xcodeproj/project.pbxproj | 208 +++++++++++- ...ync End-to-End UI Tests App Store.xcscheme | 138 ++++++++ .../Sync End-to-End UI Tests.xcscheme | 139 ++++++++ .../View/AddBookmarkModalViewController.swift | 2 + DuckDuckGo/Menus/MainMenu.swift | 8 + DuckDuckGo/Menus/MainMenuActions.swift | 6 + .../AddressBarButtonsViewController.swift | 2 +- .../View/NavigationBarViewController.swift | 1 + .../PasswordManagementLoginItemView.swift | 3 + .../PasswordManagementViewController.swift | 10 +- .../View/PasswordManager.storyboard | 147 ++++---- SyncE2EUITests/CriticalPathsTests.swift | 319 ++++++++++++++++++ 14 files changed, 979 insertions(+), 76 deletions(-) create mode 100644 Configuration/UITests/SyncE2EUITests.xcconfig create mode 100644 Configuration/UITests/SyncE2EUITestsAppStore.xcconfig create mode 100644 DuckDuckGo.xcodeproj/xcshareddata/xcschemes/Sync End-to-End UI Tests App Store.xcscheme create mode 100644 DuckDuckGo.xcodeproj/xcshareddata/xcschemes/Sync End-to-End UI Tests.xcscheme create mode 100644 SyncE2EUITests/CriticalPathsTests.swift diff --git a/Configuration/UITests/SyncE2EUITests.xcconfig b/Configuration/UITests/SyncE2EUITests.xcconfig new file mode 100644 index 0000000000..1121738b64 --- /dev/null +++ b/Configuration/UITests/SyncE2EUITests.xcconfig @@ -0,0 +1,36 @@ +// Copyright © 2022 DuckDuckGo. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +#include "../Common.xcconfig" + +CODE_SIGN_IDENTITY[config=CI][sdk=macosx*] = +CODE_SIGN_STYLE[config=CI][sdk=macosx*] = Manual +CODE_SIGNING_ALLOWED[config=CI][sdk=macosx*] = NO +COPY_PHASE_STRIP = NO +DEAD_CODE_STRIPPING = YES +DEVELOPMENT_TEAM[config=CI][sdk=macosx*] = +ENABLE_USER_SCRIPT_SANDBOXING = YES +GCC_NO_COMMON_BLOCKS = YES +GENERATE_INFOPLIST_FILE = YES +LD_RUNPATH_SEARCH_PATHS = $(inherited) @executable_path/../Frameworks @loader_path/../Frameworks +LOCALIZATION_PREFERS_STRING_CATALOGS = YES + +MACOSX_DEPLOYMENT_TARGET = 11.4 + +PRODUCT_BUNDLE_IDENTIFIER = com.duckduckgo.SyncE2EUITests +PRODUCT_NAME = $(TARGET_NAME) +PROVISIONING_PROFILE_SPECIFIER[config=CI][sdk=macosx*] = +SWIFT_EMIT_LOC_STRINGS = NO +TEST_TARGET_NAME = DuckDuckGo Privacy Browser diff --git a/Configuration/UITests/SyncE2EUITestsAppStore.xcconfig b/Configuration/UITests/SyncE2EUITestsAppStore.xcconfig new file mode 100644 index 0000000000..17c15db6ef --- /dev/null +++ b/Configuration/UITests/SyncE2EUITestsAppStore.xcconfig @@ -0,0 +1,36 @@ +// Copyright © 2022 DuckDuckGo. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +#include "../Common.xcconfig" + +CODE_SIGN_IDENTITY[config=CI][sdk=macosx*] = +CODE_SIGN_STYLE[config=CI][sdk=macosx*] = Manual +CODE_SIGNING_ALLOWED[config=CI][sdk=macosx*] = NO +COPY_PHASE_STRIP = NO +DEAD_CODE_STRIPPING = YES +DEVELOPMENT_TEAM[config=CI][sdk=macosx*] = +ENABLE_USER_SCRIPT_SANDBOXING = YES +GCC_NO_COMMON_BLOCKS = YES +GENERATE_INFOPLIST_FILE = YES +LD_RUNPATH_SEARCH_PATHS = $(inherited) @executable_path/../Frameworks @loader_path/../Frameworks +LOCALIZATION_PREFERS_STRING_CATALOGS = YES + +MACOSX_DEPLOYMENT_TARGET = 11.4 + +PRODUCT_BUNDLE_IDENTIFIER = com.duckduckgo.SyncE2EUITestsAppStore +PRODUCT_NAME = $(TARGET_NAME) +PROVISIONING_PROFILE_SPECIFIER[config=CI][sdk=macosx*] = +SWIFT_EMIT_LOC_STRINGS = NO +TEST_TARGET_NAME = DuckDuckGo Privacy Browser App Store diff --git a/DuckDuckGo.xcodeproj/project.pbxproj b/DuckDuckGo.xcodeproj/project.pbxproj index 6776156d71..910ffeb5b4 100644 --- a/DuckDuckGo.xcodeproj/project.pbxproj +++ b/DuckDuckGo.xcodeproj/project.pbxproj @@ -952,6 +952,7 @@ 37534CA3281132CB002621E7 /* TabLazyLoaderDataSource.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37534CA2281132CB002621E7 /* TabLazyLoaderDataSource.swift */; }; 37534CA52811987D002621E7 /* AdjacentItemEnumeratorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37534CA42811987D002621E7 /* AdjacentItemEnumeratorTests.swift */; }; 37534CA8281198CD002621E7 /* AdjacentItemEnumerator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37534CA62811988E002621E7 /* AdjacentItemEnumerator.swift */; }; + 376113CC2B29CD5B00E794BB /* CriticalPathsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 565E46DF2B2725DD0013AC2A /* CriticalPathsTests.swift */; }; 376705AF27EB488600DD8D76 /* RoundedSelectionRowView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B0511B3262CAA5A00F6079C /* RoundedSelectionRowView.swift */; }; 3767190028E58513003A2A15 /* DuckPlayerURLExtensionTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 376718FF28E58513003A2A15 /* DuckPlayerURLExtensionTests.swift */; }; 3767190328E724D8003A2A15 /* DuckPlayerURLExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3767190128E724B2003A2A15 /* DuckPlayerURLExtension.swift */; }; @@ -2144,6 +2145,7 @@ 562984712AC469E400AC20EB /* SyncPreferencesTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5629846E2AC4610100AC20EB /* SyncPreferencesTests.swift */; }; 56534DED29DF252C00121467 /* CapturingDefaultBrowserProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56534DEC29DF252C00121467 /* CapturingDefaultBrowserProvider.swift */; }; 56534DEE29DF252C00121467 /* CapturingDefaultBrowserProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56534DEC29DF252C00121467 /* CapturingDefaultBrowserProvider.swift */; }; + 565E46E02B2725DD0013AC2A /* CriticalPathsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 565E46DF2B2725DD0013AC2A /* CriticalPathsTests.swift */; }; 566B195D29CDB692007E38F4 /* MoreOptionsMenuTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 566B195C29CDB692007E38F4 /* MoreOptionsMenuTests.swift */; }; 566B196429CDB824007E38F4 /* MoreOptionsMenuTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 566B195C29CDB692007E38F4 /* MoreOptionsMenuTests.swift */; }; 566B196529CDB828007E38F4 /* CapturingOptionsButtonMenuDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 566B196029CDB7C9007E38F4 /* CapturingOptionsButtonMenuDelegate.swift */; }; @@ -3018,6 +3020,13 @@ remoteGlobalIDString = 3706FA6A293F65D500E42796; remoteInfo = "DuckDuckGo Privacy Browser App Store"; }; + 376113D52B29CD6800E794BB /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = AA585D76248FD31100E9A3E2 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 3706FA6A293F65D500E42796; + remoteInfo = "DuckDuckGo Privacy Browser App Store"; + }; 4B1AD8A225FC27E200261379 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = AA585D76248FD31100E9A3E2 /* Project object */; @@ -3025,6 +3034,13 @@ remoteGlobalIDString = AA585D7D248FD31100E9A3E2; remoteInfo = "DuckDuckGo Privacy Browser"; }; + 565E46E32B2725DD0013AC2A /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = AA585D76248FD31100E9A3E2 /* Project object */; + proxyType = 1; + remoteGlobalIDString = AA585D7D248FD31100E9A3E2; + remoteInfo = "DuckDuckGo Privacy Browser"; + }; 7B4CE8DF26F02108009134B1 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = AA585D76248FD31100E9A3E2 /* Project object */; @@ -3220,6 +3236,9 @@ 37534CA2281132CB002621E7 /* TabLazyLoaderDataSource.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TabLazyLoaderDataSource.swift; sourceTree = ""; }; 37534CA42811987D002621E7 /* AdjacentItemEnumeratorTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AdjacentItemEnumeratorTests.swift; sourceTree = ""; }; 37534CA62811988E002621E7 /* AdjacentItemEnumerator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AdjacentItemEnumerator.swift; sourceTree = ""; }; + 376113C52B29BCD600E794BB /* SyncE2EUITests.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = SyncE2EUITests.xcconfig; sourceTree = ""; }; + 376113D42B29CD5B00E794BB /* SyncE2EUITests App Store.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "SyncE2EUITests App Store.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; + 376113D72B29D0F800E794BB /* SyncE2EUITestsAppStore.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = SyncE2EUITestsAppStore.xcconfig; sourceTree = ""; }; 376718FF28E58513003A2A15 /* DuckPlayerURLExtensionTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DuckPlayerURLExtensionTests.swift; sourceTree = ""; }; 3767190128E724B2003A2A15 /* DuckPlayerURLExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DuckPlayerURLExtension.swift; sourceTree = ""; }; 376C4DB828A1A48A00CC0F5B /* FirePopoverViewModelTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FirePopoverViewModelTests.swift; sourceTree = ""; }; @@ -3588,6 +3607,8 @@ 5603D90529B7B746007F9F01 /* MockTabViewItemDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MockTabViewItemDelegate.swift; sourceTree = ""; }; 5629846E2AC4610100AC20EB /* SyncPreferencesTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SyncPreferencesTests.swift; sourceTree = ""; }; 56534DEC29DF252C00121467 /* CapturingDefaultBrowserProvider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CapturingDefaultBrowserProvider.swift; sourceTree = ""; }; + 565E46DD2B2725DC0013AC2A /* SyncE2EUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = SyncE2EUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + 565E46DF2B2725DD0013AC2A /* CriticalPathsTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CriticalPathsTests.swift; sourceTree = ""; }; 566B195C29CDB692007E38F4 /* MoreOptionsMenuTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MoreOptionsMenuTests.swift; sourceTree = ""; }; 566B196029CDB7C9007E38F4 /* CapturingOptionsButtonMenuDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CapturingOptionsButtonMenuDelegate.swift; sourceTree = ""; }; 567DA93E29E8045D008AC5EE /* MockEmailStorage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MockEmailStorage.swift; sourceTree = ""; }; @@ -4273,6 +4294,13 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + 376113CD2B29CD5B00E794BB /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; 4B1AD89A25FC27E200261379 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; @@ -4374,6 +4402,13 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + 565E46DA2B2725DC0013AC2A /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; 7B4CE8D726F02108009134B1 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; @@ -4792,6 +4827,8 @@ 378C76DA296843460092E949 /* UITests */ = { isa = PBXGroup; children = ( + 376113C52B29BCD600E794BB /* SyncE2EUITests.xcconfig */, + 376113D72B29D0F800E794BB /* SyncE2EUITestsAppStore.xcconfig */, 378B588C295CF446002C0CC0 /* UITests.xcconfig */, ); path = UITests; @@ -5791,6 +5828,14 @@ path = Mocks; sourceTree = ""; }; + 565E46DE2B2725DD0013AC2A /* SyncE2EUITests */ = { + isa = PBXGroup; + children = ( + 565E46DF2B2725DD0013AC2A /* CriticalPathsTests.swift */, + ); + path = SyncE2EUITests; + sourceTree = ""; + }; 566B195F29CDB7A9007E38F4 /* Mocks */ = { isa = PBXGroup; children = ( @@ -6355,6 +6400,7 @@ 4B25375C2A11BE7500610219 /* NetworkProtectionSystemExtension */, 9D9AE9132AAA3B450026E7DC /* DuckDuckGoDBPBackgroundAgent */, 7BA7CC0D2AD11DC80042E5CE /* DuckDuckGoVPN */, + 565E46DE2B2725DD0013AC2A /* SyncE2EUITests */, AA585D7F248FD31100E9A3E2 /* Products */, 85AE2FF024A33A2D002D507F /* Frameworks */, ); @@ -6379,6 +6425,8 @@ 9D9AE8D12AAA39A70026E7DC /* DuckDuckGoDBPBackgroundAgent.app */, 9D9AE8F22AAA39D30026E7DC /* .app */, 4B957C412AC7AE700062CA31 /* DuckDuckGo Privacy Pro.app */, + 565E46DD2B2725DC0013AC2A /* SyncE2EUITests.xctest */, + 376113D42B29CD5B00E794BB /* SyncE2EUITests App Store.xctest */, ); name = Products; sourceTree = ""; @@ -7989,6 +8037,24 @@ productReference = 3706FEB2293F662100E42796 /* Integration Tests App Store.xctest */; productType = "com.apple.product-type.bundle.unit-test"; }; + 376113C82B29CD5B00E794BB /* SyncE2EUITests App Store */ = { + isa = PBXNativeTarget; + buildConfigurationList = 376113CF2B29CD5B00E794BB /* Build configuration list for PBXNativeTarget "SyncE2EUITests App Store" */; + buildPhases = ( + 376113CB2B29CD5B00E794BB /* Sources */, + 376113CD2B29CD5B00E794BB /* Frameworks */, + 376113CE2B29CD5B00E794BB /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + 376113D62B29CD6800E794BB /* PBXTargetDependency */, + ); + name = "SyncE2EUITests App Store"; + productName = DuckDuckGoSyncUITests; + productReference = 376113D42B29CD5B00E794BB /* SyncE2EUITests App Store.xctest */; + productType = "com.apple.product-type.bundle.ui-testing"; + }; 4B1AD89C25FC27E200261379 /* Integration Tests */ = { isa = PBXNativeTarget; buildConfigurationList = 4B1AD8A625FC27E200261379 /* Build configuration list for PBXNativeTarget "Integration Tests" */; @@ -8190,6 +8256,24 @@ productReference = 4B957C412AC7AE700062CA31 /* DuckDuckGo Privacy Pro.app */; productType = "com.apple.product-type.application"; }; + 565E46DC2B2725DC0013AC2A /* SyncE2EUITests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 565E46E52B2725DD0013AC2A /* Build configuration list for PBXNativeTarget "SyncE2EUITests" */; + buildPhases = ( + 565E46D92B2725DC0013AC2A /* Sources */, + 565E46DA2B2725DC0013AC2A /* Frameworks */, + 565E46DB2B2725DC0013AC2A /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + 565E46E42B2725DD0013AC2A /* PBXTargetDependency */, + ); + name = SyncE2EUITests; + productName = DuckDuckGoSyncUITests; + productReference = 565E46DD2B2725DC0013AC2A /* SyncE2EUITests.xctest */; + productType = "com.apple.product-type.bundle.ui-testing"; + }; 7B4CE8D926F02108009134B1 /* UI Tests */ = { isa = PBXNativeTarget; buildConfigurationList = 7B4CE8E526F02108009134B1 /* Build configuration list for PBXNativeTarget "UI Tests" */; @@ -8367,6 +8451,9 @@ 3706FE9B293F662100E42796 = { TestTargetID = 3706FA6A293F65D500E42796; }; + 376113C82B29CD5B00E794BB = { + TestTargetID = 3706FA6A293F65D500E42796; + }; 4B1AD89C25FC27E200261379 = { CreatedOnToolsVersion = 12.4; TestTargetID = AA585D7D248FD31100E9A3E2; @@ -8388,6 +8475,10 @@ 4B4D603C2A0B290200BCD287 = { CreatedOnToolsVersion = 14.3; }; + 565E46DC2B2725DC0013AC2A = { + CreatedOnToolsVersion = 15.0; + TestTargetID = AA585D7D248FD31100E9A3E2; + }; 7B4CE8D926F02108009134B1 = { CreatedOnToolsVersion = 12.5.1; TestTargetID = AA585D7D248FD31100E9A3E2; @@ -8426,10 +8517,12 @@ projectRoot = ""; targets = ( AA585D7D248FD31100E9A3E2 /* DuckDuckGo Privacy Browser */, + 3706FA6A293F65D500E42796 /* DuckDuckGo Privacy Browser App Store */, 7B4CE8D926F02108009134B1 /* UI Tests */, + 565E46DC2B2725DC0013AC2A /* SyncE2EUITests */, + 376113C82B29CD5B00E794BB /* SyncE2EUITests App Store */, AA585D8F248FD31400E9A3E2 /* Unit Tests */, 4B1AD89C25FC27E200261379 /* Integration Tests */, - 3706FA6A293F65D500E42796 /* DuckDuckGo Privacy Browser App Store */, 3706FDD3293F661700E42796 /* Unit Tests App Store */, 3706FE9B293F662100E42796 /* Integration Tests App Store */, B6EC37E729B5DA2A001ACE79 /* tests-server */, @@ -8541,6 +8634,13 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + 376113CE2B29CD5B00E794BB /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; 4B1AD89B25FC27E200261379 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; @@ -8645,6 +8745,13 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + 565E46DB2B2725DC0013AC2A /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; 7B4CE8D826F02108009134B1 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; @@ -9980,6 +10087,14 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + 376113CB2B29CD5B00E794BB /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 376113CC2B29CD5B00E794BB /* CriticalPathsTests.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; 4B1AD89925FC27E200261379 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; @@ -10834,6 +10949,14 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + 565E46D92B2725DC0013AC2A /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 565E46E02B2725DD0013AC2A /* CriticalPathsTests.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; 7B4CE8D626F02108009134B1 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; @@ -11826,6 +11949,11 @@ target = 3706FA6A293F65D500E42796 /* DuckDuckGo Privacy Browser App Store */; targetProxy = 37079A94294236FA0031BB3C /* PBXContainerItemProxy */; }; + 376113D62B29CD6800E794BB /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 3706FA6A293F65D500E42796 /* DuckDuckGo Privacy Browser App Store */; + targetProxy = 376113D52B29CD6800E794BB /* PBXContainerItemProxy */; + }; 4B1AD8A325FC27E200261379 /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = AA585D7D248FD31100E9A3E2 /* DuckDuckGo Privacy Browser */; @@ -12066,6 +12194,34 @@ }; name = Review; }; + 376113D02B29CD5B00E794BB /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 376113D72B29D0F800E794BB /* SyncE2EUITestsAppStore.xcconfig */; + buildSettings = { + }; + name = Debug; + }; + 376113D12B29CD5B00E794BB /* CI */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 376113D72B29D0F800E794BB /* SyncE2EUITestsAppStore.xcconfig */; + buildSettings = { + }; + name = CI; + }; + 376113D22B29CD5B00E794BB /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 376113D72B29D0F800E794BB /* SyncE2EUITestsAppStore.xcconfig */; + buildSettings = { + }; + name = Release; + }; + 376113D32B29CD5B00E794BB /* Review */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 376113D72B29D0F800E794BB /* SyncE2EUITestsAppStore.xcconfig */; + buildSettings = { + }; + name = Review; + }; 4B1AD8A425FC27E200261379 /* Debug */ = { isa = XCBuildConfiguration; baseConfigurationReference = 378B58C8295CF9A7002C0CC0 /* IntegrationTests.xcconfig */; @@ -12276,6 +12432,34 @@ }; name = Review; }; + 565E46E62B2725DD0013AC2A /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 376113C52B29BCD600E794BB /* SyncE2EUITests.xcconfig */; + buildSettings = { + }; + name = Debug; + }; + 565E46E72B2725DD0013AC2A /* CI */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 376113C52B29BCD600E794BB /* SyncE2EUITests.xcconfig */; + buildSettings = { + }; + name = CI; + }; + 565E46E82B2725DD0013AC2A /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 376113C52B29BCD600E794BB /* SyncE2EUITests.xcconfig */; + buildSettings = { + }; + name = Release; + }; + 565E46E92B2725DD0013AC2A /* Review */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 376113C52B29BCD600E794BB /* SyncE2EUITests.xcconfig */; + buildSettings = { + }; + name = Review; + }; 7B4CE8E126F02108009134B1 /* Debug */ = { isa = XCBuildConfiguration; baseConfigurationReference = 378B588C295CF446002C0CC0 /* UITests.xcconfig */; @@ -12494,6 +12678,17 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; + 376113CF2B29CD5B00E794BB /* Build configuration list for PBXNativeTarget "SyncE2EUITests App Store" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 376113D02B29CD5B00E794BB /* Debug */, + 376113D12B29CD5B00E794BB /* CI */, + 376113D22B29CD5B00E794BB /* Release */, + 376113D32B29CD5B00E794BB /* Review */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; 4B1AD8A625FC27E200261379 /* Build configuration list for PBXNativeTarget "Integration Tests" */ = { isa = XCConfigurationList; buildConfigurations = ( @@ -12571,6 +12766,17 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; + 565E46E52B2725DD0013AC2A /* Build configuration list for PBXNativeTarget "SyncE2EUITests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 565E46E62B2725DD0013AC2A /* Debug */, + 565E46E72B2725DD0013AC2A /* CI */, + 565E46E82B2725DD0013AC2A /* Release */, + 565E46E92B2725DD0013AC2A /* Review */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; 7B4CE8E526F02108009134B1 /* Build configuration list for PBXNativeTarget "UI Tests" */ = { isa = XCConfigurationList; buildConfigurations = ( diff --git a/DuckDuckGo.xcodeproj/xcshareddata/xcschemes/Sync End-to-End UI Tests App Store.xcscheme b/DuckDuckGo.xcodeproj/xcshareddata/xcschemes/Sync End-to-End UI Tests App Store.xcscheme new file mode 100644 index 0000000000..5918e46ae2 --- /dev/null +++ b/DuckDuckGo.xcodeproj/xcshareddata/xcschemes/Sync End-to-End UI Tests App Store.xcscheme @@ -0,0 +1,138 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/DuckDuckGo.xcodeproj/xcshareddata/xcschemes/Sync End-to-End UI Tests.xcscheme b/DuckDuckGo.xcodeproj/xcshareddata/xcschemes/Sync End-to-End UI Tests.xcscheme new file mode 100644 index 0000000000..2dd4d0af19 --- /dev/null +++ b/DuckDuckGo.xcodeproj/xcshareddata/xcschemes/Sync End-to-End UI Tests.xcscheme @@ -0,0 +1,139 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/DuckDuckGo/Bookmarks/View/AddBookmarkModalViewController.swift b/DuckDuckGo/Bookmarks/View/AddBookmarkModalViewController.swift index cfff3a7ff4..03d51e53db 100644 --- a/DuckDuckGo/Bookmarks/View/AddBookmarkModalViewController.swift +++ b/DuckDuckGo/Bookmarks/View/AddBookmarkModalViewController.swift @@ -90,6 +90,8 @@ final class AddBookmarkModalViewController: NSViewController { updateWithCurrentTabWebsite() updateWithExistingBookmark() updateAddButton() + bookmarkTitleTextField.setAccessibilityIdentifier("Title Text Field") + urlTextField.setAccessibilityIdentifier("URL Text Field") } override func viewWillAppear() { diff --git a/DuckDuckGo/Menus/MainMenu.swift b/DuckDuckGo/Menus/MainMenu.swift index 7c9f7c3505..dc532e19f3 100644 --- a/DuckDuckGo/Menus/MainMenu.swift +++ b/DuckDuckGo/Menus/MainMenu.swift @@ -383,6 +383,7 @@ import Subscription updateBookmarksBarMenuItem() updateShortcutMenuItems() updateLoggingMenuItems() + updateInternalUserItem() updateRemoteConfigurationInfo() } @@ -534,6 +535,8 @@ import Subscription // MARK: - Debug + 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") { @@ -593,6 +596,7 @@ import Subscription NSMenuItem(title: "Logging").submenu(setupLoggingMenu()) } + debugMenu.addItem(internalUserItem) debugMenu.autoenablesItems = false return debugMenu } @@ -623,6 +627,10 @@ import Subscription return menu } + private func updateInternalUserItem() { + internalUserItem.title = NSApp.delegateTyped.internalUserDecider.isInternalUser ? "Remove Internal User State" : "Set Internal User State" + } + private func updateLoggingMenuItems() { guard let loggingMenu else { return } diff --git a/DuckDuckGo/Menus/MainMenuActions.swift b/DuckDuckGo/Menus/MainMenuActions.swift index 1ec5294a4b..8a30695b31 100644 --- a/DuckDuckGo/Menus/MainMenuActions.swift +++ b/DuckDuckGo/Menus/MainMenuActions.swift @@ -674,6 +674,12 @@ extension MainViewController { UserDefaults.standard.set(false, forKey: UserDefaultsWrapper.Key.homePageUserInteractedWithSurveyDay0.rawValue) } + @objc func internalUserState(_ sender: Any?) { + guard let internalUserDecider = NSApp.delegateTyped.internalUserDecider as? DefaultInternalUserDecider else { return } + let state = internalUserDecider.isInternalUser + internalUserDecider.debugSetInternalUserState(!state) + } + @objc func resetDailyPixels(_ sender: Any?) { UserDefaults.standard.removePersistentDomain(forName: DailyPixel.Constant.dailyPixelStorageIdentifier) } diff --git a/DuckDuckGo/NavigationBar/View/AddressBarButtonsViewController.swift b/DuckDuckGo/NavigationBar/View/AddressBarButtonsViewController.swift index 8e0bf5a64c..233995c7a4 100644 --- a/DuckDuckGo/NavigationBar/View/AddressBarButtonsViewController.swift +++ b/DuckDuckGo/NavigationBar/View/AddressBarButtonsViewController.swift @@ -265,7 +265,7 @@ final class AddressBarButtonsViewController: NSViewController { private func updateBookmarkButtonVisibility() { guard view.window?.isPopUpWindow == false else { return } - + bookmarkButton.setAccessibilityIdentifier("Bookmarks Button") let hasEmptyAddressBar = textFieldValue?.isEmpty ?? true var isUrlBookmarked = false if let url = tabCollectionViewModel.selectedTabViewModel?.tab.content.url, diff --git a/DuckDuckGo/NavigationBar/View/NavigationBarViewController.swift b/DuckDuckGo/NavigationBar/View/NavigationBarViewController.swift index 253dd20f8f..292c04a4b6 100644 --- a/DuckDuckGo/NavigationBar/View/NavigationBarViewController.swift +++ b/DuckDuckGo/NavigationBar/View/NavigationBarViewController.swift @@ -188,6 +188,7 @@ final class NavigationBarViewController: NSViewController { passwordManagementButton.sendAction(on: .leftMouseDown) optionsButton.toolTip = UserText.applicationMenuTooltip + optionsButton.setAccessibilityIdentifier("Options Button") networkProtectionButton.toolTip = UserText.networkProtectionButtonTooltip diff --git a/DuckDuckGo/SecureVault/View/PasswordManagementLoginItemView.swift b/DuckDuckGo/SecureVault/View/PasswordManagementLoginItemView.swift index 65b41fc85a..1352b5f510 100644 --- a/DuckDuckGo/SecureVault/View/PasswordManagementLoginItemView.swift +++ b/DuckDuckGo/SecureVault/View/PasswordManagementLoginItemView.swift @@ -102,6 +102,7 @@ struct PasswordManagementLoginItemView: View { secondaryButton: cancelButton ) } + .accessibility(identifier: "Login item View") } } @@ -175,6 +176,7 @@ private struct UsernameView: View { TextField("", text: $model.username) .textFieldStyle(RoundedBorderTextFieldStyle()) .padding(.bottom, interItemSpacing) + .accessibility(identifier: "Username TextField") } else { @@ -439,6 +441,7 @@ private struct WebsiteView: View { TextField("", text: $model.domain) .textFieldStyle(RoundedBorderTextFieldStyle()) .padding(.bottom, interItemSpacing) + .accessibility(identifier: "Website TextField") } else { if let domainURL = model.domain.url { diff --git a/DuckDuckGo/SecureVault/View/PasswordManagementViewController.swift b/DuckDuckGo/SecureVault/View/PasswordManagementViewController.swift index 7360356841..6eec5995d7 100644 --- a/DuckDuckGo/SecureVault/View/PasswordManagementViewController.swift +++ b/DuckDuckGo/SecureVault/View/PasswordManagementViewController.swift @@ -45,6 +45,7 @@ final class PasswordManagementViewController: NSViewController { weak var delegate: PasswordManagementDelegate? + @IBOutlet weak var unlockYourAutofillInfo: NSButtonCell! @IBOutlet var listContainer: NSView! @IBOutlet var itemContainer: NSView! @IBOutlet var addVaultItemButton: NSButton! @@ -171,6 +172,8 @@ final class PasswordManagementViewController: NSViewController { moreButton.sendAction(on: .leftMouseDown) exportLoginItem.title = UserText.exportLogins + unlockYourAutofillInfo.setAccessibilityIdentifier("Unlock Autofill") + addVaultItemButton.setAccessibilityIdentifier("add item") NotificationCenter.default.publisher(for: .deviceBecameLocked) .receive(on: DispatchQueue.main) @@ -248,7 +251,12 @@ final class PasswordManagementViewController: NSViewController { private func promptForAuthenticationIfNecessary() { let authenticator = DeviceAuthenticator.shared - +#if DEBUG + if ProcessInfo.processInfo.environment["UITEST_MODE"] == "1" { + toggleLockScreen(hidden: true) + return + } +#endif toggleLockScreen(hidden: !authenticator.requiresAuthentication) authenticator.authenticateUser(reason: .unlockLogins) { authenticationResult in diff --git a/DuckDuckGo/SecureVault/View/PasswordManager.storyboard b/DuckDuckGo/SecureVault/View/PasswordManager.storyboard index 157d696f24..0f53f9b381 100644 --- a/DuckDuckGo/SecureVault/View/PasswordManager.storyboard +++ b/DuckDuckGo/SecureVault/View/PasswordManager.storyboard @@ -1,7 +1,7 @@ - + - + @@ -27,7 +27,7 @@ - + @@ -57,7 +57,7 @@ - + @@ -68,7 +68,7 @@ - + @@ -113,15 +113,15 @@ - + @@ -200,15 +200,15 @@ - + @@ -602,9 +603,6 @@