Skip to content

Enable SwiftLint rule: collection_alignment#25562

Open
mokagio wants to merge 1 commit into
trunkfrom
mokagio/collection_alignment-swiftlint
Open

Enable SwiftLint rule: collection_alignment#25562
mokagio wants to merge 1 commit into
trunkfrom
mokagio/collection_alignment-swiftlint

Conversation

@mokagio
Copy link
Copy Markdown
Contributor

@mokagio mokagio commented May 15, 2026

What and why

Enables SwiftLint's collection_alignment rule, which requires all elements in a multi-line collection literal to be vertically aligned with the first element. 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 array_init and colon).
  • collection_alignment is not auto-correctable, so all 46 violations across 9 files were fixed by hand.
  • Every change is whitespace-only — adjusting continuation-line indentation to align with the first collection element. No behaviour changes.
  • No suppressions, nothing left for human review.

How to test

  • rake lint reports zero collection_alignment violations.
  • The WordPress scheme builds clean locally (xcodebuild -workspace WordPress.xcworkspace -scheme WordPress -destination 'platform=iOS Simulator,name=iPhone 17 Pro' build).

The rule requires all elements in a collection literal to be vertically
aligned with the first element.

`collection_alignment` is not auto-correctable, so the 46 violations
across 9 files were aligned by hand.
The change is whitespace-only — no behaviour changes.

Part of the Orchard SwiftLint rules rollout campaign.
Copilot AI review requested due to automatic review settings May 15, 2026 02:39
@mokagio mokagio self-assigned this May 15, 2026
@mokagio mokagio added this to the 26.9 milestone May 15, 2026
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 collection_alignment rule and updates existing collection literals to satisfy the new alignment requirement without changing behavior.

Changes:

  • Adds collection_alignment to .swiftlint.yml.
  • Re-aligns multi-line dictionaries, arrays, and constraint collections across app, extension, data, and test files.

Reviewed changes

Copilot reviewed 1 out of 10 changed files in this pull request and generated no comments.

Show a summary per file
File Description
.swiftlint.yml Enables the new collection alignment rule.
WordPress/WordPressShareExtension/Sources/UI/ShareExtensionEditorViewController.swift Aligns attributed string dictionaries.
WordPress/Classes/ViewRelated/Support/SupportTableViewController.swift Aligns constraint array entries and closing bracket.
WordPress/Classes/ViewRelated/Stats/Shared Views/Stats Detail/SiteStatsInsightsDetailsViewModel.swift Aligns annual stats row array entries.
WordPress/Classes/ViewRelated/Plugins/Views/PluginDetailViewHeaderCell.swift Aligns attributed string dictionary entries.
WordPress/Classes/ViewRelated/Me/App Settings/AppSettingsViewController.swift Aligns settings configuration dictionary entries.
WordPress/Classes/ViewRelated/Gutenberg/Layout Picker/GutenbergLightNavigationController.swift Aligns title attribute dictionaries in appearance setup.
WordPress/Classes/ViewRelated/Blog/Site Management/DeleteSiteViewController.swift Aligns attributed string dictionaries.
Tests/WordPressKitTests/WordPressKitTests/Tests/MediaServiceRemoteRESTTests.swift Aligns test JSON dictionaries.
Sources/WordPressData/Swift/CoreDataHelper.swift Aligns Core Data store options dictionary.

💡 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 Number32239
VersionPR #25562
Bundle IDorg.wordpress.alpha
Commitde2929e
Installation URL2f9vc3lrnpjh8
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 Number32239
VersionPR #25562
Bundle IDcom.jetpack.alpha
Commitde2929e
Installation URL7g918eva6k0uo
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.

4 participants