Skip to content

switch_case_alignment false positive when using explicit return on a switch expression #5191

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

Closed
2 tasks done
allenhumphreys opened this issue Aug 25, 2023 · 0 comments · Fixed by #5193
Closed
2 tasks done
Assignees
Labels
bug Unexpected and reproducible misbehavior.

Comments

@allenhumphreys
Copy link

allenhumphreys commented Aug 25, 2023

New Issue Checklist

Describe the bug

This is very similar to #5080, except it's a different case of the same problem. So I think this issue should be simple to convey.

Environment

  • SwiftLint version (run swiftlint version to be sure)? 0.52.4
  • Installation method used (Homebrew, CocoaPods, building from source, etc)? homebrew
  • Which Xcode version are you using (check xcodebuild -version)? 15A5229h
// This triggers a violation:
```swift
... <other stuff that prevents using an implicit return>

return switch environment.state {
case .normal: inverseColor ? palette.genericWhite : palette.secondaryIndigo
case .pressed: inverseColor ? palette.neutral200 : palette.secondaryNavy
case .disabled: inverseColor ? palette.neutral300 : palette.secondarySlate
}
@SimplyDanny SimplyDanny added bug Unexpected and reproducible misbehavior. good first issue Issue to be taken up by new contributors yet unfamiliar with the project. labels Aug 25, 2023
@SimplyDanny SimplyDanny self-assigned this Aug 25, 2023
@SimplyDanny SimplyDanny removed the good first issue Issue to be taken up by new contributors yet unfamiliar with the project. label Aug 25, 2023
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