realm / SwiftLint

A tool to enforce Swift style and conventions.
https://realm.github.io/SwiftLint
MIT License
18.46k stars 2.2k forks source link

ShorthandOptionalBinding Rule not working? #5557

Closed tomhuettmann closed 2 months ago

tomhuettmann commented 2 months ago

New Issue Checklist

Describe the bug

Currently, the shorthand_optional_binding seems not to work for me as expected. None of the triggering examples are showing up for me after enabling the rule. Rule definition: https://realm.github.io/SwiftLint/shorthand_optional_binding.html What am I doing wrong?

I am using 0.53.0, installed via Homebrew.

Code

I would expect that the following triggers the rule for example:

if let i = i {}

forcing me to refactor it to:

if let i {}
SimplyDanny commented 2 months ago

I suspect this is an issue with the slightly broken version comparison algorithm assuming you are on Swift 5.10. Are you?

The issue has been fixed in #5526. I hope a new release can be provided in the upcoming days.

tomhuettmann commented 2 months ago

Yeah, I am using Swift 5.10. Thank you very much, looking forward for the next release 🚀 Let's assume this will fix my problem, otherwise I'll reopen this issue :)

tomhuettmann commented 1 month ago

Small Followup: Works perfectly now with the newest SwiftLint version. Thanks ❤️