Skip to content

Conversation

@tonyskansf
Copy link

Add a new opt-in rule that detects unnecessary throws, helping avoid misleading definitions and requirements for the caller to write unnecessary error handling.

@SwiftLintBot
Copy link

SwiftLintBot commented Apr 28, 2025

3871 Warnings
⚠️ Big PR
⚠️ This PR introduced a violation in Alamofire: /Source/Core/URLConvertible+URLRequestConvertible.swift:51:25: Warning: Superfluous 'throws'; body of this function does not throw any error (unneeded_throws_rethrows)
⚠️ This PR introduced a violation in Alamofire: /Source/Core/URLConvertible+URLRequestConvertible.swift:84:32: Warning: Superfluous 'throws'; body of this function does not throw any error (unneeded_throws_rethrows)
⚠️ This PR introduced a violation in Alamofire: /Source/Core/DataStreamRequest.swift:554:41: Warning: Superfluous 'throws'; body of this function does not throw any error (unneeded_throws_rethrows)
⚠️ This PR introduced a violation in Alamofire: /Source/Core/DataStreamRequest.swift:562:41: Warning: Superfluous 'throws'; body of this function does not throw any error (unneeded_throws_rethrows)
⚠️ This PR introduced a violation in Alamofire: /Source/Core/UploadRequest.swift:168:36: Warning: Superfluous 'throws'; body of this function does not throw any error (unneeded_throws_rethrows)
⚠️ This PR introduced a violation in Alamofire: /Source/Features/ServerTrustEvaluation.swift:447:67: Warning: Superfluous 'throws'; body of this function does not throw any error (unneeded_throws_rethrows)
⚠️ This PR introduced a violation in Alamofire: /Source/Features/ResponseSerialization.swift:85:42: Warning: Superfluous 'throws'; body of this function does not throw any error (unneeded_throws_rethrows)
⚠️ This PR introduced a violation in Alamofire: /Source/Features/ResponseSerialization.swift:93:42: Warning: Superfluous 'throws'; body of this function does not throw any error (unneeded_throws_rethrows)
⚠️ This PR introduced a violation in Alamofire: /Tests/UploadTests.swift:360:73: Warning: Superfluous 'throws'; body of this function does not throw any error (unneeded_throws_rethrows)
⚠️ This PR introduced a violation in Alamofire: /Tests/ConcurrencyTests.swift:767:53: Warning: Superfluous 'throws'; body of this function does not throw any error (unneeded_throws_rethrows)
⚠️ This PR introduced a violation in Alamofire: /Tests/ConcurrencyTests.swift:783:48: Warning: Superfluous 'throws'; body of this function does not throw any error (unneeded_throws_rethrows)
⚠️ This PR introduced a violation in Alamofire: /Tests/SessionTests.swift:1283:86: Warning: Superfluous 'throws'; body of this function does not throw any error (unneeded_throws_rethrows)
⚠️ This PR introduced a violation in Alamofire: /Tests/SessionTests.swift:1338:88: Warning: Superfluous 'throws'; body of this function does not throw any error (unneeded_throws_rethrows)
⚠️ This PR introduced a violation in Alamofire: /Tests/ResponseSerializationTests.swift:1188:112: Warning: Superfluous 'throws'; body of this function does not throw any error (unneeded_throws_rethrows)
⚠️ This PR introduced a violation in Alamofire: /Tests/ResponseSerializationTests.swift:1211:39: Warning: Superfluous 'throws'; body of this function does not throw any error (unneeded_throws_rethrows)
⚠️ This PR introduced a violation in Brave: /ios/brave-ios/Plugins/LeoAssetsPlugin/LeoAssetsPlugin.swift:13:74: Warning: Superfluous 'throws'; body of this function does not throw any error (unneeded_throws_rethrows)
⚠️ This PR introduced a violation in Brave: /ios/brave-ios/Plugins/IntentBuilderPlugin/IntentBuilderPlugin.swift:11:74: Warning: Superfluous 'throws'; body of this function does not throw any error (unneeded_throws_rethrows)
⚠️ This PR introduced a violation in Brave: /ios/brave-ios/Tests/ClientTests/User Scripts/RandomConfigurationTests.swift:12:50: Warning: Superfluous 'throws'; body of this function does not throw any error (unneeded_throws_rethrows)
⚠️ This PR introduced a violation in Brave: /ios/brave-ios/Tests/ClientTests/User Scripts/RandomConfigurationTests.swift:39:64: Warning: Superfluous 'throws'; body of this function does not throw any error (unneeded_throws_rethrows)
⚠️ This PR introduced a violation in Brave: /ios/brave-ios/Tests/ClientTests/User Scripts/RandomConfigurationTests.swift:64:64: Warning: Superfluous 'throws'; body of this function does not throw any error (unneeded_throws_rethrows)
⚠️ This PR introduced a violation in Brave: /ios/brave-ios/Tests/ClientTests/User Scripts/RandomConfigurationTests.swift:94:48: Warning: Superfluous 'throws'; body of this function does not throw any error (unneeded_throws_rethrows)
⚠️ This PR introduced a violation in Brave: /ios/brave-ios/Tests/ClientTests/ClientTests.swift:16:34: Warning: Superfluous 'throws'; body of this function does not throw any error (unneeded_throws_rethrows)
⚠️ This PR introduced a violation in Brave: /ios/brave-ios/Tests/ClientTests/DomainUserScriptTests.swift:12:41: Warning: Superfluous 'throws'; body of this function does not throw any error (unneeded_throws_rethrows)
⚠️ This PR introduced a violation in Brave: /ios/brave-ios/Tests/ClientTests/DomainUserScriptTests.swift:39:39: Warning: Superfluous 'throws'; body of this function does not throw any error (unneeded_throws_rethrows)
⚠️ This PR introduced a violation in Brave: /ios/brave-ios/Tests/ClientTests/UniversalLinkManagerTests.swift:13:31: Warning: Superfluous 'throws'; body of this function does not throw any error (unneeded_throws_rethrows)
⚠️ This PR introduced a violation in Brave: /ios/brave-ios/Tests/ClientTests/PageDataTests.swift:19:38: Warning: Superfluous 'throws'; body of this function does not throw any error (unneeded_throws_rethrows)
⚠️ This PR introduced a violation in Brave: /ios/brave-ios/Tests/ClientTests/PageDataTests.swift:131:36: Warning: Superfluous 'throws'; body of this function does not throw any error (unneeded_throws_rethrows)
⚠️ This PR introduced a violation in Brave: /ios/brave-ios/Tests/ClientTests/Web Filters/WebsiteRedirectsTests.swift:14:34: Warning: Superfluous 'throws'; body of this function does not throw any error (unneeded_throws_rethrows)
⚠️ This PR introduced a violation in Brave: /ios/brave-ios/Tests/ClientTests/Web Filters/WebsiteRedirectsTests.swift:19:37: Warning: Superfluous 'throws'; body of this function does not throw any error (unneeded_throws_rethrows)
⚠️ This PR introduced a violation in Brave: /ios/brave-ios/Tests/ClientTests/Web Filters/ResourceDownloaderStreamTests.swift:11:45: Warning: Superfluous 'throws'; body of this function does not throw any error (unneeded_throws_rethrows)
⚠️ This PR introduced a violation in Brave: /ios/brave-ios/Tests/ClientTests/Web Filters/ResourceDownloaderStreamTests.swift:41:40: Warning: Superfluous 'throws'; body of this function does not throw any error (unneeded_throws_rethrows)
⚠️ This PR introduced a violation in Brave: /ios/brave-ios/Tests/ClientTests/Web Filters/ResourceDownloaderTests.swift:11:41: Warning: Superfluous 'throws'; body of this function does not throw any error (unneeded_throws_rethrows)
⚠️ This PR introduced a violation in Brave: /ios/brave-ios/Tests/ClientTests/Web Filters/ResourceDownloaderTests.swift:67:37: Warning: Superfluous 'throws'; body of this function does not throw any error (unneeded_throws_rethrows)
⚠️ This PR introduced a violation in Brave: /ios/brave-ios/Tests/ClientTests/InitialSearchEnginesTests.swift:20:28: Warning: Superfluous 'throws'; body of this function does not throw any error (unneeded_throws_rethrows)
⚠️ This PR introduced a violation in Brave: /ios/brave-ios/Tests/ClientTests/InitialSearchEnginesTests.swift:46:28: Warning: Superfluous 'throws'; body of this function does not throw any error (unneeded_throws_rethrows)
⚠️ This PR introduced a violation in Brave: /ios/brave-ios/Tests/ClientTests/InitialSearchEnginesTests.swift:55:39: Warning: Superfluous 'throws'; body of this function does not throw any error (unneeded_throws_rethrows)
⚠️ This PR introduced a violation in Brave: /ios/brave-ios/Tests/ClientTests/InitialSearchEnginesTests.swift:82:19: Warning: Superfluous 'throws'; body of this function does not throw any error (unneeded_throws_rethrows)
⚠️ This PR introduced a violation in Brave: /ios/brave-ios/Tests/ClientTests/InitialSearchEnginesTests.swift:116:19: Warning: Superfluous 'throws'; body of this function does not throw any error (unneeded_throws_rethrows)
⚠️ This PR introduced a violation in Brave: /ios/brave-ios/Tests/ClientTests/InitialSearchEnginesTests.swift:150:19: Warning: Superfluous 'throws'; body of this function does not throw any error (unneeded_throws_rethrows)
⚠️ This PR introduced a violation in Brave: /ios/brave-ios/Tests/ClientTests/InitialSearchEnginesTests.swift:183:19: Warning: Superfluous 'throws'; body of this function does not throw any error (unneeded_throws_rethrows)
⚠️ This PR introduced a violation in Brave: /ios/brave-ios/Tests/ClientTests/InitialSearchEnginesTests.swift:217:19: Warning: Superfluous 'throws'; body of this function does not throw any error (unneeded_throws_rethrows)
⚠️ This PR introduced a violation in Brave: /ios/brave-ios/Tests/ClientTests/InitialSearchEnginesTests.swift:251:19: Warning: Superfluous 'throws'; body of this function does not throw any error (unneeded_throws_rethrows)
⚠️ This PR introduced a violation in Brave: /ios/brave-ios/Tests/ClientTests/InitialSearchEnginesTests.swift:283:19: Warning: Superfluous 'throws'; body of this function does not throw any error (unneeded_throws_rethrows)
⚠️ This PR introduced a violation in Brave: /ios/brave-ios/Tests/ClientTests/Web Filters/GroupedAdBlockEngineTests.swift:60:47: Warning: Superfluous 'throws'; body of this function does not throw any error (unneeded_throws_rethrows)
⚠️ This PR introduced a violation in Brave: /ios/brave-ios/Tests/ClientTests/Web Filters/GroupedAdBlockEngineTests.swift:94:37: Warning: Superfluous 'throws'; body of this function does not throw any error (unneeded_throws_rethrows)
⚠️ This PR introduced a violation in Brave: /ios/brave-ios/Tests/ClientTests/Web Filters/GroupedAdBlockEngineTests.swift:166:26: Warning: Superfluous 'throws'; body of this function does not throw any error (unneeded_throws_rethrows)
⚠️ This PR introduced a violation in Brave: /ios/brave-ios/Tests/ClientTests/Helpers/BraveSkusWebHelperTests.swift:80:47: Warning: Superfluous 'throws'; body of this function does not throw any error (unneeded_throws_rethrows)
⚠️ This PR introduced a violation in Brave: /ios/brave-ios/Tests/AIChatTests/AIChatTest.swift:13:39: Warning: Superfluous 'throws'; body of this function does not throw any error (unneeded_throws_rethrows)
⚠️ This PR introduced a violation in Brave: /ios/brave-ios/Tests/AIChatTests/AIChatTest.swift:42:42: Warning: Superfluous 'throws'; body of this function does not throw any error (unneeded_throws_rethrows)
⚠️ This PR introduced a violation in Brave: /ios/brave-ios/Tests/AIChatTests/AIChatTest.swift:103:29: Warning: Superfluous 'throws'; body of this function does not throw any error (unneeded_throws_rethrows)
⚠️ This PR introduced a violation in Brave: /ios/brave-ios/Tests/AIChatTests/AIChatTest.swift:149:32: Warning: Superfluous 'throws'; body of this function does not throw any error (unneeded_throws_rethrows)
⚠️ This PR introduced a violation in Brave: /ios/brave-ios/Tests/AIChatTests/AIChatTest.swift:195:32: Warning: Superfluous 'throws'; body of this function does not throw any error (unneeded_throws_rethrows)
⚠️ This PR introduced a violation in Brave: /ios/brave-ios/Tests/AIChatTests/AIChatTest.swift:236:30: Warning: Superfluous 'throws'; body of this function does not throw any error (unneeded_throws_rethrows)
⚠️ This PR introduced a violation in Brave: /ios/brave-ios/Tests/ClientTests/AdBlockGroupsManagerTests.swift:26:43: Warning: Superfluous 'throws'; body of this function does not throw any error (unneeded_throws_rethrows)
⚠️ This PR introduced a violation in Brave: /ios/brave-ios/Tests/ClientTests/AdBlockGroupsManagerTests.swift:120:40: Warning: Superfluous 'throws'; body of this function does not throw any error (unneeded_throws_rethrows)
⚠️ This PR introduced a violation in Brave: /ios/brave-ios/Tests/ClientTests/Helpers/DefaultBrowserHelperTests.swift:14:31: Warning: Superfluous 'throws'; body of this function does not throw any error (unneeded_throws_rethrows)
⚠️ This PR introduced a violation in Brave: /ios/brave-ios/Tests/BraveTalkTests/BraveTalkJitsiTranscriptProcessorTests.swift:17:34: Warning: Superfluous 'throws'; body of this function does not throw any error (unneeded_throws_rethrows)
⚠️ This PR introduced a violation in Brave: /ios/brave-ios/Tests/PlaylistUITests/PlayerModelTests.swift:72:42: Warning: Superfluous 'throws'; body of this function does not throw any error (unneeded_throws_rethrows)
⚠️ This PR introduced a violation in Brave: /ios/brave-ios/Tests/BrowserMenuTests/BrowserMenuTests.swift:300:51: Warning: Superfluous 'throws'; body of this function does not throw any error (unneeded_throws_rethrows)
⚠️ This PR introduced a violation in Brave: /ios/brave-ios/Sources/BraveWidgetsModels/LockScreenFavoriteIntentHandler.swift:14:11: Warning: Superfluous 'throws'; body of this function does not throw any error (unneeded_throws_rethrows)
⚠️ This PR introduced a violation in Brave: /ios/brave-ios/Sources/Playlist/PlaylistManager.swift:967:48: Warning: Superfluous 'throws'; body of this function does not throw any error (unneeded_throws_rethrows)
⚠️ This PR introduced a violation in Brave: /ios/brave-ios/Sources/Web/Chromium/ChromiumTabState.swift:428:45: Warning: Superfluous 'throws'; body of this function does not throw any error (unneeded_throws_rethrows)
⚠️ This PR introduced a violation in Brave: /ios/brave-ios/Sources/BraveStore/Subscription/SDK/AppStoreSDK.swift:448:53: Warning: Superfluous 'throws'; body of this function does not throw any error (unneeded_throws_rethrows)
⚠️ This PR introduced a violation in Brave: /ios/brave-ios/Sources/BraveStore/Subscription/SDK/AppStoreSDK.swift:471:63: Warning: Superfluous 'throws'; body of this function does not throw any error (unneeded_throws_rethrows)
⚠️ This PR introduced a violation in Brave: /ios/brave-ios/Sources/Shared/Extensions/URLExtensions.swift:290:57: Warning: Superfluous 'throws'; body of this function does not throw any error (unneeded_throws_rethrows)
⚠️ This PR introduced a violation in Brave: /ios/brave-ios/Sources/Brave/Frontend/Reader/ReaderModeCache.swift:44:64: Warning: Superfluous 'throws'; body of this function does not throw any error (unneeded_throws_rethrows)
⚠️ This PR introduced a violation in Brave: /ios/brave-ios/Sources/Brave/Frontend/Settings/Features/ShieldsPrivacy/Clearables.swift:121:22: Warning: Superfluous 'throws'; body of this function does not throw any error (unneeded_throws_rethrows)
⚠️ This PR introduced a violation in Brave: /ios/brave-ios/Sources/Brave/Frontend/Settings/Features/ShieldsPrivacy/Clearables.swift:143:22: Warning: Superfluous 'throws'; body of this function does not throw any error (unneeded_throws_rethrows)
⚠️ This PR introduced a violation in Brave: /ios/brave-ios/Sources/Brave/Frontend/Settings/Features/ShieldsPrivacy/Clearables.swift:161:22: Warning: Superfluous 'throws'; body of this function does not throw any error (unneeded_throws_rethrows)
⚠️ This PR introduced a violation in Brave: /ios/brave-ios/Sources/Brave/Frontend/Settings/Features/ShieldsPrivacy/Clearables.swift:190:22: Warning: Superfluous 'throws'; body of this function does not throw any error (unneeded_throws_rethrows)
⚠️ This PR introduced a violation in Brave: /ios/brave-ios/Sources/Brave/Frontend/Settings/Features/ShieldsPrivacy/Clearables.swift:203:22: Warning: Superfluous 'throws'; body of this function does not throw any error (unneeded_throws_rethrows)
⚠️ This PR introduced a violation in Brave: /ios/brave-ios/Sources/Brave/Frontend/Settings/Features/ShieldsPrivacy/Clearables.swift:225:22: Warning: Superfluous 'throws'; body of this function does not throw any error (unneeded_throws_rethrows)
⚠️ This PR introduced a violation in Brave: /ios/brave-ios/Sources/Brave/Frontend/Settings/Features/ShieldsPrivacy/Clearables.swift:247:22: Warning: Superfluous 'throws'; body of this function does not throw any error (unneeded_throws_rethrows)
⚠️ This PR introduced a violation in Brave: /ios/brave-ios/Sources/Brave/Frontend/Settings/Features/ShieldsPrivacy/Clearables.swift:264:22: Warning: Superfluous 'throws'; body of this function does not throw any error (unneeded_throws_rethrows)
⚠️ This PR introduced a violation in Brave: /ios/brave-ios/Sources/Brave/Frontend/Brave Translate/BraveTranslateTabHelper.swift:286:27: Warning: Superfluous 'throws'; body of this function does not throw any error (unneeded_throws_rethrows)
⚠️ This PR introduced a violation in Brave: /ios/brave-ios/Sources/Brave/Frontend/Browser/FrequencyQuery.swift:123:59: Warning: Superfluous 'throws'; body of this function does not throw any error (unneeded_throws_rethrows)
⚠️ This PR introduced a violation in Brave: /ios/brave-ios/Sources/Brave/Frontend/Browser/Search/SearchEngines.swift:397:46: Warning: Superfluous 'throws'; body of this function does not throw any error (unneeded_throws_rethrows)
⚠️ This PR introduced a violation in Brave: /ios/brave-ios/Sources/Brave/WebFilters/AdBlock/AdBlockEngineManager.swift:621:84: Warning: Superfluous 'throws'; body of this function does not throw any error (unneeded_throws_rethrows)
⚠️ This PR introduced a violation in Brave: /ios/brave-ios/Sources/Brave/WebFilters/DownloadResourceInterface.swift:79:43: Warning: Superfluous 'throws'; body of this function does not throw any error (unneeded_throws_rethrows)
⚠️ This PR introduced a violation in Brave: /ios/brave-ios/Sources/Brave/WebFilters/DownloadResourceInterface.swift:104:40: Warning: Superfluous 'throws'; body of this function does not throw any error (unneeded_throws_rethrows)
⚠️ This PR introduced a violation in Brave: /ios/brave-ios/Sources/BraveShared/Extensions/URLExtensions.swift:332:79: Warning: Superfluous 'throws'; body of this function does not throw any error (unneeded_throws_rethrows)
⚠️ This PR introduced a violation in DuckDuckGo: /macOS/IntegrationTests/Configurations/ConfigurationManagerIntegrationTests.swift:32:36: Warning: Superfluous 'throws'; body of this function does not throw any error (unneeded_throws_rethrows)
⚠️ This PR introduced a violation in DuckDuckGo: /macOS/IntegrationTests/Configurations/ConfigurationManagerIntegrationTests.swift:46:39: Warning: Superfluous 'throws'; body of this function does not throw any error (unneeded_throws_rethrows)
⚠️ This PR introduced a violation in DuckDuckGo: /macOS/IntegrationTests/AppKitPrivateMethodsAvailabilityTests.swift:29:28: Warning: Superfluous 'throws'; body of this function does not throw any error (unneeded_throws_rethrows)
⚠️ This PR introduced a violation in DuckDuckGo: /macOS/IntegrationTests/Tab/SearchNonexistentDomainTests.swift:75:36: Warning: Superfluous 'throws'; body of this function does not throw any error (unneeded_throws_rethrows)
⚠️ This PR introduced a violation in DuckDuckGo: /macOS/IntegrationTests/Tab/SearchNonexistentDomainTests.swift:87:70: Warning: Superfluous 'throws'; body of this function does not throw any error (unneeded_throws_rethrows)
⚠️ This PR introduced a violation in DuckDuckGo: /macOS/IntegrationTests/Tab/SearchNonexistentDomainTests.swift:212:77: Warning: Superfluous 'throws'; body of this function does not throw any error (unneeded_throws_rethrows)
⚠️ This PR introduced a violation in DuckDuckGo: /macOS/IntegrationTests/BookmarksBar/BookmarksBarViewControllerTests.swift:29:47: Warning: Superfluous 'throws'; body of this function does not throw any error (unneeded_throws_rethrows)
⚠️ This PR introduced a violation in DuckDuckGo: /macOS/IntegrationTests/BookmarksBar/BookmarksBarViewControllerTests.swift:33:39: Warning: Superfluous 'throws'; body of this function does not throw any error (unneeded_throws_rethrows)
⚠️ This PR introduced a violation in DuckDuckGo: /macOS/IntegrationTests/BookmarksBar/BookmarksBarViewControllerTests.swift:40:67: Warning: Superfluous 'throws'; body of this function does not throw any error (unneeded_throws_rethrows)
⚠️ This PR introduced a violation in DuckDuckGo: /macOS/IntegrationTests/BookmarksBar/BookmarksBarViewControllerTests.swift:63:72: Warning: Superfluous 'throws'; body of this function does not throw any error (unneeded_throws_rethrows)
⚠️ This PR introduced a violation in DuckDuckGo: /macOS/IntegrationTests/BookmarksBar/BookmarksBarViewControllerTests.swift:89:97: Warning: Superfluous 'throws'; body of this function does not throw any error (unneeded_throws_rethrows)
⚠️ This PR introduced a violation in DuckDuckGo: /macOS/IntegrationTests/BookmarksBar/BookmarksBarViewControllerTests.swift:101:73: Warning: Superfluous 'throws'; body of this function does not throw any error (unneeded_throws_rethrows)
⚠️ This PR introduced a violation in DuckDuckGo: /macOS/IntegrationTests/DataImport/CSVImporterIntegrationTests.swift:53:49: Warning: Superfluous 'throws'; body of this function does not throw any error (unneeded_throws_rethrows)
⚠️ This PR introduced a violation in DuckDuckGo: /macOS/IntegrationTests/Onboarding/OnboardingNavigatingTests.swift:44:49: Warning: Superfluous 'throws'; body of this function does not throw any error (unneeded_throws_rethrows)
⚠️ This PR introduced a violation in DuckDuckGo: /SharedPackages/BrowserServicesKit/Tests/ConfigurationTests/Mocks/MockStoreWithStorage.swift:59:67: Warning: Superfluous 'throws'; body of this function does not throw any error (unneeded_throws_rethrows)
⚠️ This PR introduced a violation in DuckDuckGo: /macOS/IntegrationTests/History/HistoryIntegrationTests.swift:49:33: Warning: Superfluous 'throws'; body of this function does not throw any error (unneeded_throws_rethrows)
⚠️ This PR introduced a violation in DuckDuckGo: /macOS/IntegrationTests/History/HistoryIntegrationTests.swift:68:36: Warning: Superfluous 'throws'; body of this function does not throw any error (unneeded_throws_rethrows)
⚠️ This PR introduced a violation in DuckDuckGo: /macOS/IntegrationTests/Onboarding/BrowserTabViewControllerOnboardingTests.swift:70:39: Warning: Superfluous 'throws'; body of this function does not throw any error (unneeded_throws_rethrows)
⚠️ This PR introduced a violation in DuckDuckGo: /macOS/IntegrationTests/Onboarding/BrowserTabViewControllerOnboardingTests.swift:87:73: Warning: Superfluous 'throws'; body of this function does not throw any error (unneeded_throws_rethrows)
⚠️ This PR introduced a violation in DuckDuckGo: /macOS/IntegrationTests/Onboarding/BrowserTabViewControllerOnboardingTests.swift:97:77: Warning: Superfluous 'throws'; body of this function does not throw any error (unneeded_throws_rethrows)
⚠️ This PR introduced a violation in DuckDuckGo: /macOS/IntegrationTests/Onboarding/BrowserTabViewControllerOnboardingTests.swift:111:95: Warning: Superfluous 'throws'; body of this function does not throw any error (unneeded_throws_rethrows)
⚠️ This PR introduced a violation in DuckDuckGo: /macOS/IntegrationTests/Onboarding/BrowserTabViewControllerOnboardingTests.swift:120:97: Warning: Superfluous 'throws'; body of this function does not throw any error (unneeded_throws_rethrows)
⚠️ This PR introduced a violation in DuckDuckGo: /macOS/IntegrationTests/Onboarding/BrowserTabViewControllerOnboardingTests.swift:129:95: Warning: Superfluous 'throws'; body of this function does not throw any error (unneeded_throws_rethrows)
⚠️ This PR introduced a violation in DuckDuckGo: /macOS/IntegrationTests/Onboarding/BrowserTabViewControllerOnboardingTests.swift:138:97: Warning: Superfluous 'throws'; body of this function does not throw any error (unneeded_throws_rethrows)
⚠️ This PR introduced a violation in DuckDuckGo: /macOS/IntegrationTests/Onboarding/BrowserTabViewControllerOnboardingTests.swift:147:95: Warning: Superfluous 'throws'; body of this function does not throw any error (unneeded_throws_rethrows)
⚠️ This PR introduced a violation in DuckDuckGo: /macOS/IntegrationTests/Onboarding/BrowserTabViewControllerOnboardingTests.swift:156:100: Warning: Superfluous 'throws'; body of this function does not throw any error (unneeded_throws_rethrows)
⚠️ This PR introduced a violation in DuckDuckGo: /macOS/IntegrationTests/Onboarding/BrowserTabViewControllerOnboardingTests.swift:165:81: Warning: Superfluous 'throws'; body of this function does not throw any error (unneeded_throws_rethrows)
⚠️ This PR introduced a violation in DuckDuckGo: /macOS/IntegrationTests/Onboarding/BrowserTabViewControllerOnboardingTests.swift:194:94: Warning: Superfluous 'throws'; body of this function does not throw any error (unneeded_throws_rethrows)
⚠️ This PR introduced a violation in DuckDuckGo: /macOS/IntegrationTests/Onboarding/BrowserTabViewControllerOnboardingTests.swift:228:93: Warning: Superfluous 'throws'; body of this function does not throw any error (unneeded_throws_rethrows)
⚠️ This PR introduced a violation in DuckDuckGo: /macOS/IntegrationTests/Onboarding/BrowserTabViewControllerOnboardingTests.swift:245:100: Warning: Superfluous 'throws'; body of this function does not throw any error (unneeded_throws_rethrows)
⚠️ This PR introduced a violation in DuckDuckGo: /macOS/IntegrationTests/Onboarding/BrowserTabViewControllerOnboardingTests.swift:261:108: Warning: Superfluous 'throws'; body of this function does not throw any error (unneeded_throws_rethrows)
⚠️ This PR introduced a violation in DuckDuckGo: /macOS/IntegrationTests/Onboarding/BrowserTabViewControllerOnboardingTests.swift:277:64: Warning: Superfluous 'throws'; body of this function does not throw any error (unneeded_throws_rethrows)
⚠️ This PR introduced a violation in DuckDuckGo: /macOS/IntegrationTests/Onboarding/BrowserTabViewControllerOnboardingTests.swift:313:99: Warning: Superfluous 'throws'; body of this function does not throw any error (unneeded_throws_rethrows)
⚠️ This PR introduced a violation in DuckDuckGo: /macOS/IntegrationTests/Onboarding/BrowserTabViewControllerOnboardingTests.swift:331:75: Warning: Superfluous 'throws'; body of this function does not throw any error (unneeded_throws_rethrows)
⚠️ This PR introduced a violation in DuckDuckGo: /SharedPackages/BrowserServicesKit/Tests/ConfigurationTests/TrackerDataURLOverriderTests.swift:75:62: Warning: Superfluous 'throws'; body of this function does not throw any error (unneeded_throws_rethrows)
⚠️ This PR introduced a violation in DuckDuckGo: /macOS/IntegrationTests/Downloads/DownloadListCoordinatorTests.swift:345:79: Warning: Superfluous 'throws'; body of this function does not throw any error (unneeded_throws_rethrows)
⚠️ This PR introduced a violation in DuckDuckGo: /macOS/IntegrationTests/Downloads/DownloadListCoordinatorTests.swift:405:75: Warning: Superfluous 'throws'; body of this function does not throw any error (unneeded_throws_rethrows)
⚠️ This PR introduced a violation in DuckDuckGo: /macOS/IntegrationTests/Downloads/DownloadListCoordinatorTests.swift:465:76: Warning: Superfluous 'throws'; body of this function does not throw any error (unneeded_throws_rethrows)
⚠️ This PR introduced a violation in DuckDuckGo: /SharedPackages/BrowserServicesKit/Tests/MaliciousSiteProtectionTests/Mocks/MockMaliciousSiteProtectionAPIClient.swift:102:40: Warning: Superfluous 'throws'; closure type does not throw any error (unneeded_throws_rethrows)
⚠️ This PR introduced a violation in DuckDuckGo: /macOS/IntegrationTests/Tab/AddressBarTests.swift:68:33: Warning: Superfluous 'throws'; body of this function does not throw any error (unneeded_throws_rethrows)
⚠️ This PR introduced a violation in DuckDuckGo: /macOS/IntegrationTests/Tab/AddressBarTests.swift:98:36: Warning: Superfluous 'throws'; body of this function does not throw any error (unneeded_throws_rethrows)
⚠️ This PR introduced a violation in DuckDuckGo: /macOS/IntegrationTests/Tab/AddressBarTests.swift:296:69: Warning: Superfluous 'throws'; body of this function does not throw any error (unneeded_throws_rethrows)
⚠️ This PR introduced a violation in DuckDuckGo: /macOS/IntegrationTests/Tab/AddressBarTests.swift:303:63: Warning: Superfluous 'throws'; body of this function does not throw any error (unneeded_throws_rethrows)
⚠️ Danger found 3871 violations with this PR. Due to GitHub's max issue comment size, the number shown has been truncated to 125.
18 Messages
📖 Building this branch resulted in a binary size of 25519.6 KiB vs 25468.68 KiB when built on main (0% larger).
📖 Linting Aerial with this PR took 1.05 s vs 1.06 s on main (0% faster).
📖 Linting Alamofire with this PR took 1.42 s vs 1.41 s on main (0% slower).
📖 Linting Brave with this PR took 9.54 s vs 9.52 s on main (0% slower).
📖 Linting DuckDuckGo with this PR took 28.22 s vs 28.13 s on main (0% slower).
📖 Linting Firefox with this PR took 14.83 s vs 14.78 s on main (0% slower).
📖 Linting Kickstarter with this PR took 10.82 s vs 10.78 s on main (0% slower).
📖 Linting Moya with this PR took 0.56 s vs 0.56 s on main (0% slower).
📖 Linting NetNewsWire with this PR took 3.25 s vs 3.23 s on main (0% slower).
📖 Linting Nimble with this PR took 0.85 s vs 0.85 s on main (0% slower).
📖 Linting PocketCasts with this PR took 9.66 s vs 9.65 s on main (0% slower).
📖 Linting Quick with this PR took 0.5 s vs 0.49 s on main (2% slower).
📖 Linting Realm with this PR took 4.9 s vs 4.9 s on main (0% slower).
📖 Linting Sourcery with this PR took 2.5 s vs 2.49 s on main (0% slower).
📖 Linting Swift with this PR took 5.76 s vs 5.73 s on main (0% slower).
📖 Linting VLC with this PR took 1.53 s vs 1.53 s on main (0% slower).
📖 Linting Wire with this PR took 23.23 s vs 23.18 s on main (0% slower).
📖 Linting WordPress with this PR took 15.61 s vs 15.57 s on main (0% slower).

Generated by 🚫 Danger

@msrutek-paylocity
Copy link

@SimplyDanny Any thoughts on this? :)

@msrutek-paylocity
Copy link

@tonyskansf It seems that some conflicts have arisen, would you mind resolving them? Thanks!

Copy link
Collaborator

@SimplyDanny SimplyDanny left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks very good already! You thought about many special cases already. The rule also makes sense. But adding it as opt-in is important as it can cause false positives in the context of protocol implementations (and maybe more occasions).

I've added a few comments. Please also check the findings reported by the OSS scan.

@SimplyDanny
Copy link
Collaborator

You need to rebase onto main first to fix conflicts and build with the latest infrastructure. Ignore the conflict in GeneratedTests.swift and let the file be deleted. Eventually, run swift run swiftlint-dev rules register again.

@tonyskansf tonyskansf force-pushed the opt-in-unneeded-throws-rule branch from 3c154d1 to bb93bfe Compare July 22, 2025 08:09
@tonyskansf
Copy link
Author

@SimplyDanny
Sorry it took me a while to find time for the review comments. I've addressed all of them. I've gone through all the available warnings and identified one false-positive which I fixed in 032538b.

Please can you take a look again. Appreciate your time!

Thank you

Copy link
Collaborator

@SimplyDanny SimplyDanny left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm back! However, a bit late. Sorry for that.

* Support deinitializers and subscripts in `function_body_length` rule.
[SimplyDanny](https://github.com/SimplyDanny)

* Add opt-in `unneeded_throws_rethrows` rules that triggers when declarations
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* Add opt-in `unneeded_throws_rethrows` rules that triggers when declarations
* Add opt-in `unneeded_throws_rethrows` rule that triggers when declarations


static let description = RuleDescription(
identifier: "unneeded_throws_rethrows",
name: "Unneeded (re)throws keyword",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
name: "Unneeded (re)throws keyword",
name: "Unneeded (Re)Throws Keyword",

}

override func visit(_ node: FunctionCallExprSyntax) -> SyntaxVisitorContinueKind {
if node.containsTaskDeclaration {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thinking again about this case ... it's not only relevant for tasks but for closures passed to functions in general, isn't it? So if we have

func h() throws {
  f(1) {
    try g()
  }
}

currently this doesn't trigger, yet it should.

}
"""),
Example("""
let foo: () throws -> Void
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would trigger

let foo: () throws -> Void = bar

but shouldn't as we don't know what bar exactly is.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants