Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pattern_matching_keywords should not trigger in some cases #3852

Closed
2 tasks done
blindmonkey opened this issue Feb 11, 2022 · 0 comments · Fixed by #5375
Closed
2 tasks done

pattern_matching_keywords should not trigger in some cases #3852

blindmonkey opened this issue Feb 11, 2022 · 0 comments · Fixed by #5375
Labels
bug Unexpected and reproducible misbehavior.

Comments

@blindmonkey
Copy link

New Issue Checklist

Describe the bug

pattern_matching_keywords opt-in rule will warn this type of code.

let z = 3
switch foo {
case (let x, let y, z): break
}

When matching a pattern it may be desirable to bind some elements of the tuple while comparing others to an existing variable. Currently, pattern_matching_keywords simply counts the number of lets and vars, causing it to miss cases like this.

Environment

  • SwiftLint version (run swiftlint version to be sure)? Verified via unit tests on master
  • Installation method used (Homebrew, CocoaPods, building from source, etc)? Built from source
  • Paste your configuration file:
opt_in_rules:
  - pattern_matching_keywords
  • Which Xcode version are you using (check xcodebuild -version)? Xcode 13.2.1, Build version 13C100
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Unexpected and reproducible misbehavior.
Projects
None yet
2 participants