Skip to content

Enable SwiftLint rule: untyped_error_in_catch#25571

Merged
mokagio merged 2 commits into
trunkfrom
mokagio/swiftlint-untyped-error-in-catch
May 21, 2026
Merged

Enable SwiftLint rule: untyped_error_in_catch#25571
mokagio merged 2 commits into
trunkfrom
mokagio/swiftlint-untyped-error-in-catch

Conversation

@mokagio
Copy link
Copy Markdown
Contributor

@mokagio mokagio commented May 20, 2026

Enables the untyped_error_in_catch SwiftLint rule, which flags catch let <name> patterns where the binding doesn't add a type cast — the implicit error constant is enough.

  • Auto-fixed: 20 violations across 16 files via bundle exec rake lintfix.
  • Agentic fixes: none.
  • Left for human review: none.

Part of the Orchard SwiftLint rollout campaign.

`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>
@mokagio mokagio requested a review from a team as a code owner May 20, 2026 12:45
Copilot AI review requested due to automatic review settings May 20, 2026 12:45
@mokagio mokagio self-assigned this May 20, 2026
@mokagio mokagio added this to the 26.9 milestone May 20, 2026
@dangermattic
Copy link
Copy Markdown
Collaborator

dangermattic commented May 20, 2026

1 Warning
⚠️ This PR is assigned to the milestone 26.9. The due date for this milestone has already passed.
Please assign it to a milestone with a later deadline or check whether the release for this milestone has already been finished.

Generated by 🚫 Danger

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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_catch in .swiftlint.yml.
  • Replaced redundant catch let … patterns with catch across 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.

Comment thread WordPress/Classes/Utility/ZendeskUtils.swift Outdated
@wpmobilebot
Copy link
Copy Markdown
Contributor

🤖 Build Failure Analysis

This build has failures. Claude has analyzed them - check the build annotations for details.

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>
@mokagio mokagio enabled auto-merge May 21, 2026 06:39
@wpmobilebot
Copy link
Copy Markdown
Contributor

App Icon📲 You can test the changes from this Pull Request in WordPress by scanning the QR code below to install the corresponding build.
App NameWordPress
ConfigurationRelease-Alpha
Build Number32274
VersionPR #25571
Bundle IDorg.wordpress.alpha
Commitc651d6f
Installation URL79so446trdc5o
Automatticians: You can use our internal self-serve MC tool to give yourself access to those builds if needed.

@wpmobilebot
Copy link
Copy Markdown
Contributor

App Icon📲 You can test the changes from this Pull Request in Jetpack by scanning the QR code below to install the corresponding build.
App NameJetpack
ConfigurationRelease-Alpha
Build Number32274
VersionPR #25571
Bundle IDcom.jetpack.alpha
Commitc651d6f
Installation URL5ka0gvn6iu2mg
Automatticians: You can use our internal self-serve MC tool to give yourself access to those builds if needed.

@mokagio mokagio added this pull request to the merge queue May 21, 2026
Merged via the queue into trunk with commit d393c42 May 21, 2026
24 checks passed
@mokagio mokagio deleted the mokagio/swiftlint-untyped-error-in-catch branch May 21, 2026 07:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants