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

operator_usage_whitespace rule false positive for unwrapping of the optional optional #2728

Closed
2 tasks done
ghost opened this issue Apr 23, 2019 · 3 comments
Closed
2 tasks done
Labels
bug Unexpected and reproducible misbehavior.

Comments

@ghost
Copy link

ghost commented Apr 23, 2019

SwiftLint thinks that ?? is a nil coalescing operator, while it's a unwrapping of the optional optional.

func success(for item: Item) {
    item.successHandler??() // <- triggers operator_usage_whitespace, bc there's no spaces around ??, but item.successHandler is an optional optional
}

Would be nice to make operator_usage_whitespace rule configurable so you can exclude specific operators (??). #1013

@jpsim jpsim added the bug Unexpected and reproducible misbehavior. label Apr 29, 2019
@emmavray
Copy link

emmavray commented May 7, 2019

@madyanov it may be helpful to see some context (particularly the definition of item.successHandler), could you post that?

@stale
Copy link

stale bot commented Nov 8, 2020

This issue has been automatically marked as stale because it has not had any recent activity. Please comment to prevent this issue from being closed. Thank you for your contributions!

@stale stale bot added the wontfix Issues that became stale and were auto-closed by a bot. label Nov 8, 2020
@stale stale bot closed this as completed Nov 15, 2020
@jpsim jpsim reopened this Feb 23, 2021
@jpsim jpsim removed the wontfix Issues that became stale and were auto-closed by a bot. label Feb 23, 2021
@marcelofabri
Copy link
Collaborator

Fixed in #3962

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
Development

No branches or pull requests

3 participants