Skip to content

Enable SwiftLint rule: contains_over_filter_count#25522

Closed
mokagio wants to merge 1 commit intotrunkfrom
mokagio/swiftlint-contains-over-filter-count
Closed

Enable SwiftLint rule: contains_over_filter_count#25522
mokagio wants to merge 1 commit intotrunkfrom
mokagio/swiftlint-contains-over-filter-count

Conversation

@mokagio
Copy link
Copy Markdown
Contributor

@mokagio mokagio commented May 4, 2026

Summary

Enables SwiftLint's contains_over_filter_count rule.

The rule prefers xs.contains { ... } over xs.filter { ... }.count > 0 (and the == 0 / != 0 variants), which is a performance and clarity win.

  • 0 violations in the current codebase, so no code changes — only the rule entry in .swiftlint.yml.
  • The rule will catch new occurrences in future code.

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`. No violations in current codebase.
The rule going forward will catch `xs.filter { ... }.count > 0` patterns
that should use `xs.contains { ... }` instead.

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>
@dangermattic
Copy link
Copy Markdown
Collaborator

1 Message
📖 This PR is still a Draft: some checks will be skipped.

Generated by 🚫 Danger

@mokagio mokagio added this to the 26.9 milestone May 4, 2026
@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 Number32098
VersionPR #25522
Bundle IDorg.wordpress.alpha
Commitae6007f
Installation URL7j19bua29v1p0
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 Number32098
VersionPR #25522
Bundle IDcom.jetpack.alpha
Commitae6007f
Installation URL7ueh2cu4nh0oo
Automatticians: You can use our internal self-serve MC tool to give yourself access to those builds if needed.

@mokagio
Copy link
Copy Markdown
Contributor Author

mokagio commented May 5, 2026

Superseded by #25536, which bundles this rule with the other zero-violation enables for review in a single PR. Closing in favour of that one.

Posted by Claude (Opus 4.7) on behalf of @mokagio with approval.

@mokagio mokagio closed this May 5, 2026
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.

3 participants