Skip to content

Enable SwiftLint rule: array_init#25530

Merged
mokagio merged 2 commits intotrunkfrom
mokagio/swiftlint-array-init
May 6, 2026
Merged

Enable SwiftLint rule: array_init#25530
mokagio merged 2 commits intotrunkfrom
mokagio/swiftlint-array-init

Conversation

@mokagio
Copy link
Copy Markdown
Contributor

@mokagio mokagio commented May 5, 2026

Summary

Enables SwiftLint's array_init rule.

The rule prefers Array(xs) over the xs.map { $0 } identity transform when converting a sequence into an Array.

  • See commit message for the violation count and any rewrites.
  • The change is type-preserving — local build deferred to CI.

Part of the Orchard SwiftLint rollout campaign.

Test plan

  • CI build is green.
  • swiftlint lint --strict --no-cache is clean against the rule.

🤖 Generated with Claude Code

Adds the rule to `only_rules`. The rule prefers `Array(xs)`
over the `xs.map { $0 }` identity transform when converting a
sequence into an Array.

Part of the Orchard SwiftLint rollout campaign.

---

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

Co-Authored-By: Claude Code Opus 4.7 <noreply@anthropic.com>
@mokagio mokagio self-assigned this May 5, 2026
@mokagio mokagio added this to the 26.9 milestone May 5, 2026
@wpmobilebot
Copy link
Copy Markdown
Contributor

wpmobilebot commented May 5, 2026

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 Number32147
VersionPR #25530
Bundle IDorg.wordpress.alpha
Commit5ed3fa7
Installation URL0g40sbk8v09k0
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

wpmobilebot commented May 5, 2026

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 Number32147
VersionPR #25530
Bundle IDcom.jetpack.alpha
Commit5ed3fa7
Installation URL1biv7of18spso
Automatticians: You can use our internal self-serve MC tool to give yourself access to those builds if needed.

@mokagio mokagio marked this pull request as ready for review May 6, 2026 00:59
Copilot AI review requested due to automatic review settings May 6, 2026 00:59
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 opt-in array_init rule across the repository, encouraging Array(sequence) instead of an identity map when converting to an Array.

Changes:

  • Opts into the array_init SwiftLint rule in .swiftlint.yml.
  • Adds a local suppression in BlockEditorSettingsServiceRemote for a case currently written as an identity map (but used for optional-wrapping).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
Modules/Sources/WordPressKit/BlockEditorSettingsServiceRemote.swift Adds a array_init SwiftLint suppression on an identity map in the block editor settings fetch pipeline.
.swiftlint.yml Enables the array_init SwiftLint rule as an opt-in rule.

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

Comment thread Modules/Sources/WordPressKit/BlockEditorSettingsServiceRemote.swift Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@mokagio mokagio enabled auto-merge May 6, 2026 04:54
@mokagio mokagio added this pull request to the merge queue May 6, 2026
Merged via the queue into trunk with commit 5a5c685 May 6, 2026
24 checks passed
@mokagio mokagio deleted the mokagio/swiftlint-array-init branch May 6, 2026 10:10
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