Enable SwiftLint rule: untyped_error_in_catch#25571
Merged
Merged
Conversation
`bundle exec rake lintfix` autofixed 20 `catch let error` sites across 16 files by dropping the explicit binding in favour of the implicit `error` constant. Part of the Orchard SwiftLint rollout campaign. --- Generated with the help of Claude Code, https://claude.ai/code Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Collaborator
Contributor
There was a problem hiding this comment.
Pull request overview
This PR enables SwiftLint’s untyped_error_in_catch rule and applies automated fixes to remove redundant catch let <name> bindings where no type-cast is performed.
Changes:
- Enabled
untyped_error_in_catchin.swiftlint.yml. - Replaced redundant
catch let …patterns withcatchacross multiple Swift files.
Reviewed changes
Copilot reviewed 17 out of 17 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| WordPress/WordPressScreenshotGeneration/SnapshotHelper.swift | Removes redundant catch bindings during snapshot setup and screenshot write. |
| WordPress/Classes/ViewRelated/Reader/Controllers/ReaderPostActions/ReaderBlockUserAction.swift | Simplifies catch blocks for account lookup and save failures. |
| WordPress/Classes/ViewRelated/NUX/Controllers/Social Signup/SignupEpilogueViewController.swift | Updates catch syntax in password change flow (but currently introduces an undefined identifier). |
| WordPress/Classes/ViewRelated/Me/Me Main/MeViewController.swift | Simplifies catch syntax in async refresh flow. |
| WordPress/Classes/ViewRelated/Me/App Settings/EncryptedLogTableViewController.swift | Updates catch syntax when enqueueing encrypted logs (but currently introduces an undefined identifier). |
| WordPress/Classes/Utility/ZendeskUtils.swift | Updates catch syntax in encrypted log UUID helper (but currently introduces an undefined identifier). |
| WordPress/Classes/Utility/BackgroundTasks/WeeklyRoundupBackgroundTask.swift | Simplifies catch syntax when building stats service. |
| WordPress/Classes/Services/ReaderPostStreamService.swift | Simplifies catch syntax during Core Data cleanup. |
| WordPress/Classes/Services/ReaderCardService.swift | Simplifies catch syntax during Core Data cleanup. |
| WordPress/Classes/Jetpack/JetpackMigration/Common/MigrationEmailService.swift | Simplifies catch syntax across init/send/decode code paths. |
| Sources/WordPressData/Swift/BlockedSite.swift | Simplifies catch syntax in fetch helper. |
| Sources/WordPressData/Swift/BlockedAuthor.swift | Simplifies catch syntax in fetch helper. |
| Modules/Sources/WordPressKit/SiteDesignServiceRemote.swift | Simplifies catch syntax in response parsing. |
| Modules/Sources/WordPressKit/PlanServiceRemote_ApiVersion1_3.swift | Simplifies catch syntax in plan parsing. |
| Modules/Sources/WordPressKit/FeatureFlagRemote.swift | Simplifies catch syntax for parameter serialization errors. |
| Modules/Sources/WordPressKit/DomainsServiceRemote+AllDomains.swift | Simplifies catch syntax for query parameter construction errors. |
| .swiftlint.yml | Enables the untyped_error_in_catch rule. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Contributor
🤖 Build Failure AnalysisThis build has failures. Claude has analyzed them - check the build annotations for details. |
crazytonyli
approved these changes
May 20, 2026
Something SwiftLint's (or the AI follow up?) autocorrect failed to address Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Contributor
|
| App Name | WordPress | |
| Configuration | Release-Alpha | |
| Build Number | 32274 | |
| Version | PR #25571 | |
| Bundle ID | org.wordpress.alpha | |
| Commit | c651d6f | |
| Installation URL | 79so446trdc5o |
Contributor
|
| App Name | Jetpack | |
| Configuration | Release-Alpha | |
| Build Number | 32274 | |
| Version | PR #25571 | |
| Bundle ID | com.jetpack.alpha | |
| Commit | c651d6f | |
| Installation URL | 5ka0gvn6iu2mg |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Enables the
untyped_error_in_catchSwiftLint rule, which flagscatch let <name>patterns where the binding doesn't add a type cast — the impliciterrorconstant is enough.bundle exec rake lintfix.Part of the Orchard SwiftLint rollout campaign.