Skip to content

Enable SwiftLint rule: literal_expression_end_indentation#25563

Open
mokagio wants to merge 1 commit into
trunkfrom
mokagio/swiftlint-literal-expression-end-indentation
Open

Enable SwiftLint rule: literal_expression_end_indentation#25563
mokagio wants to merge 1 commit into
trunkfrom
mokagio/swiftlint-literal-expression-end-indentation

Conversation

@mokagio
Copy link
Copy Markdown
Contributor

@mokagio mokagio commented May 15, 2026

What and why

Enables SwiftLint's literal_expression_end_indentation rule, which requires the closing bracket of a multi-line array or dictionary literal to align with the line that opened it. Part of the Orchard SwiftLint rollout campaign (Phase 3 — formatting and consistency).

Approach

  • Added the rule to only_rules in .swiftlint.yml (alphabetical order, between last_where and mark).
  • literal_expression_end_indentation is auto-correctable. rake lintfix resolved 65 of the 67 violations on its own.
  • For the remaining 2 files (RegisterDomainDetailsViewModel+RowList.swift and JetpackConnectionViewController.swift), the autocorrector miscounted the nesting and dropped closing brackets, producing code that would not compile. Those two files were reverted and the trailing brackets re-formatted by hand so the rule is satisfied without touching behaviour.
  • All changes are whitespace-only. No suppressions, nothing left for human review.

How to test

  • rake lint reports zero literal_expression_end_indentation violations.
  • The WordPress scheme builds clean locally (xcodebuild -workspace WordPress.xcworkspace -scheme WordPress -destination 'generic/platform=iOS Simulator' build).

Enforce that the closing bracket of a multi-line array or dictionary
literal aligns with the line that opened it.

65 of 67 violations were auto-corrected by `swiftlint --fix`. The
remaining 2 — RegisterDomainDetailsViewModel+RowList.swift and
JetpackConnectionViewController.swift — were reverted because the
auto-corrector miscounted the nesting and dropped closing brackets,
producing files that would not compile. They were re-formatted by hand
to satisfy the rule.

Part of the Orchard SwiftLint rollout campaign (Phase 3 — formatting
and consistency).

---

Generated with the help of Claude Code, https://code.claude.com

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings May 15, 2026 04:17
@mokagio mokagio self-assigned this May 15, 2026
@mokagio mokagio added this to the 26.9 milestone May 15, 2026
@dangermattic
Copy link
Copy Markdown
Collaborator

1 Warning
⚠️ View files have been modified, but no screenshot or video is included in the pull request. Consider adding some for clarity.

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

Enables SwiftLint’s literal_expression_end_indentation rule (Phase 3 formatting/consistency) and updates existing Swift code to conform by aligning trailing closing brackets/parens in multi-line literals.

Changes:

  • Add literal_expression_end_indentation to .swiftlint.yml opt-in rules.
  • Reformat array/dictionary literal closing brackets across app, modules, and tests to satisfy the new rule.
  • Manually correct the two remaining autocorrect edge cases to preserve compiling code.

Reviewed changes

Copilot reviewed 3 out of 35 changed files in this pull request and generated no comments.

Show a summary per file
File Description
WordPress/WordPressShareExtension/Sources/UI/ShareExtensionEditorViewController.swift Align closing brackets in multi-line literals/constraint arrays to satisfy the rule.
WordPress/Classes/ViewRelated/System/Notices/NoticeView.swift Align closing brackets in multi-line literals/constraint arrays to satisfy the rule.
WordPress/Classes/ViewRelated/System/Notices/NoticePresenter.swift Align closing brackets in multi-line literals/constraint arrays to satisfy the rule.
WordPress/Classes/ViewRelated/Support/SupportTableViewController.swift Align closing brackets in multi-line literals/constraint arrays to satisfy the rule.
WordPress/Classes/ViewRelated/Stats/Period Stats/Overview/OverviewCell.swift Align closing brackets in multi-line literals/constraint arrays to satisfy the rule.
WordPress/Classes/ViewRelated/Stats/Insights/ViewsVisitors/ViewsVisitorsLineChartCell.swift Align closing brackets in multi-line literals/constraint arrays to satisfy the rule.
WordPress/Classes/ViewRelated/Site Creation/Shared/TitleSubtitleTextfieldHeader.swift Align closing brackets in multi-line literals/constraint arrays to satisfy the rule.
WordPress/Classes/ViewRelated/Post/Revisions/Browser/Preview/RevisionPreviewViewController.swift Align closing brackets in multi-line literals/constraint arrays to satisfy the rule.
WordPress/Classes/ViewRelated/Plugins/Views/CollectionViewContainerRow.swift Align closing brackets in multi-line literals/constraint arrays to satisfy the rule.
WordPress/Classes/ViewRelated/Plugins/ViewModels/PluginViewModel.swift Align closing brackets in nested array literals (sections/rows) to satisfy the rule.
WordPress/Classes/ViewRelated/Plugins/ViewModels/PluginListViewModel.swift Align closing brackets in multi-line literals to satisfy the rule.
WordPress/Classes/ViewRelated/Plugins/ViewModels/PluginDirectoryViewModel.swift Align closing brackets in multi-line literals to satisfy the rule.
WordPress/Classes/ViewRelated/Media/CircularProgressView.swift Align closing brackets in multi-line literals/constraint arrays to satisfy the rule.
WordPress/Classes/ViewRelated/Me/App Settings/Privacy Settings/PrivacySettingsViewController.swift Align closing brackets in multi-line literals to satisfy the rule.
WordPress/Classes/ViewRelated/Me/App Settings/MediaCacheSettingsViewController.swift Align closing brackets in multi-line literals to satisfy the rule.
WordPress/Classes/ViewRelated/Jetpack/Jetpack Settings/JetpackSettingsViewController.swift Align closing brackets in multi-line literals to satisfy the rule.
WordPress/Classes/ViewRelated/Jetpack/Jetpack Settings/JetpackConnectionViewController.swift Align closing brackets in multi-line literals to satisfy the rule.
WordPress/Classes/ViewRelated/Jetpack/Install/Webview/JetpackConnectionWebViewController.swift Align closing brackets in multi-line literals to satisfy the rule.
WordPress/Classes/ViewRelated/Domains/Domain registration/RegisterDomainDetails/ViewModel/RegisterDomainDetailsViewModel+RowList.swift Fix literal closing bracket indentation for row lists to satisfy the rule.
WordPress/Classes/ViewRelated/Blog/Site Settings/LanguageSelectorViewController.swift Align closing brackets in multi-line literals to satisfy the rule.
WordPress/Classes/ViewRelated/Blog/Site Management/TableViewHeaderDetailView.swift Align closing brackets in multi-line literals/constraint arrays to satisfy the rule.
WordPress/Classes/ViewRelated/Blog/Blog Details/BlogDetailsSectionFooterView.swift Align closing brackets in multi-line literals/constraint arrays to satisfy the rule.
WordPress/Classes/ViewRelated/Aztec/ViewControllers/AztecPostViewController.swift Align closing brackets in multi-line literals/constraint arrays to satisfy the rule.
WordPress/Classes/ViewRelated/Aztec/ViewControllers/AztecAttachmentViewController.swift Align closing brackets in multi-line literals to satisfy the rule.
WordPress/Classes/Services/MediaCoordinator.swift Align closing brackets in multi-line literals to satisfy the rule.
WordPress/Classes/Extensions/UIView+Borders.swift Align closing brackets in multi-line literals/constraint arrays to satisfy the rule.
Tests/KeystoneTests/Tests/Models/BasePostTests.swift Align closing brackets in multi-line literals to satisfy the rule.
Tests/KeystoneTests/Tests/Features/SiteCreation/SiteAssemblyServiceTests.swift Align closing brackets in multi-line literals to satisfy the rule.
Sources/WordPressAuthenticator/Features/SignIn/LoginSocialErrorCell.swift Align closing brackets in multi-line literals/constraint arrays to satisfy the rule.
Sources/WordPressAuthenticator/Features/SignIn/LoginEmailViewController.swift Align closing brackets in multi-line literals/constraint arrays to satisfy the rule.
Modules/Sources/WordPressUI/Extensions/UIView+Helpers.swift Align closing brackets in multi-line literals/constraint arrays to satisfy the rule.
Modules/Sources/WordPressShared/FileManager/FileManager+FolderSize.swift Align closing brackets in multi-line literals to satisfy the rule.
Modules/Sources/WordPressKit/PluginServiceRemote.swift Align closing brackets in multi-line dictionary literals to satisfy the rule.
Modules/Sources/Support/InternalDataProvider.swift Align closing brackets in multi-line literals to satisfy the rule.
.swiftlint.yml Enable literal_expression_end_indentation in the opt-in SwiftLint ruleset.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@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 Number32240
VersionPR #25563
Bundle IDorg.wordpress.alpha
Commit17cf012
Installation URL340f1ujc4bqug
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 Number32240
VersionPR #25563
Bundle IDcom.jetpack.alpha
Commit17cf012
Installation URL4ioa24bnejkpg
Automatticians: You can use our internal self-serve MC tool to give yourself access to those builds if needed.

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