Skip to content

Add combine_flatmap lint rule#6482

Draft
ldct wants to merge 1 commit intorealm:mainfrom
ldct:ldct-combine-flatmap-rule
Draft

Add combine_flatmap lint rule#6482
ldct wants to merge 1 commit intorealm:mainfrom
ldct:ldct-combine-flatmap-rule

Conversation

@ldct
Copy link

@ldct ldct commented Feb 6, 2026

Summary

  • Adds a new combine_flatmap lint rule that warns against using Combine's flatMap operator
  • Detects both Combine.flatMap { ... } call expressions and Combine.flatMap member access references
  • Includes non-triggering examples for array flatMap and Combine.map to avoid false positives

Test plan

  • Verify non-triggering examples pass (array flatMap, Combine.map)
  • Verify triggering examples flag violations (Combine.flatMap call and member access)
  • Run swift run swiftlint-dev rules validate to confirm rule registration

🤖 Generated with Claude Code

Add a new lint rule that warns against using Combine's flatMap operator.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@ldct ldct marked this pull request as draft February 6, 2026 01:45
@SwiftLintBot
Copy link

1 Warning
⚠️ If this is a user-facing change, please include a CHANGELOG entry to credit yourself!
You can find it at CHANGELOG.md.
19 Messages
📖 Building this branch resulted in a binary size of 27261.38 KiB vs 27252.48 KiB when built on main (0% larger).
📖 Linting Aerial with this PR took 0.81 s vs 0.8 s on main (1% slower).
📖 Linting Alamofire with this PR took 1.05 s vs 1.06 s on main (0% faster).
📖 Linting Brave with this PR took 7.2 s vs 7.23 s on main (0% faster).
📖 Linting DuckDuckGo with this PR took 25.09 s vs 25.16 s on main (0% faster).
📖 Linting Firefox with this PR took 11.64 s vs 11.64 s on main (0% slower).
📖 Linting Kickstarter with this PR took 7.99 s vs 8.02 s on main (0% faster).
📖 Linting Moya with this PR took 0.47 s vs 0.47 s on main (0% slower).
📖 Linting NetNewsWire with this PR took 2.48 s vs 2.47 s on main (0% slower).
📖 Linting Nimble with this PR took 0.71 s vs 0.7 s on main (1% slower).
📖 Linting PocketCasts with this PR took 7.55 s vs 7.67 s on main (1% faster).
📖 Linting Quick with this PR took 0.48 s vs 0.45 s on main (6% slower).
📖 Linting Realm with this PR took 3.25 s vs 3.33 s on main (2% faster).
📖 Linting Sourcery with this PR took 1.9 s vs 1.89 s on main (0% slower).
📖 Linting Swift with this PR took 4.43 s vs 4.42 s on main (0% slower).
📖 Linting SwiftLintPerformanceTests with this PR took 0.34 s vs 0.37 s on main (8% faster).
📖 Linting VLC with this PR took 1.18 s vs 1.15 s on main (2% slower).
📖 Linting Wire with this PR took 18.6 s vs 18.63 s on main (0% faster).
📖 Linting WordPress with this PR took 12.44 s vs 12.49 s on main (0% faster).

Here's an example of your CHANGELOG entry:

* Add combine_flatmap lint rule.  
  [ldct](https://github.com/ldct)
  [#issue_number](https://github.com/realm/SwiftLint/issues/issue_number)

note: There are two invisible spaces after the entry's text.

Generated by 🚫 Danger

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants