SwiftLint: Validate that self is only used in escaping closures and conflicts
Use of self should be limited to escaping closures and scopes in which other declarations conflict.
About this issue
- Original URL
- State: closed
- Created 9 years ago
- Reactions: 64
- Comments: 19 (1 by maintainers)
Reopening, as there is still demand for this rule based on #3579 and prior comments on 2020.
Any status update on this “implicit_self” rule inclusion? 🤔
Thanks
I could find the “explicit_self” rule but I couldn’t find the identifier for this one.
Anyone could help me with finding it ?
Thanks!
Would love to see that implemented.
Love this. It would make searching for ref-cycles quiet a bit easier… 😃
I’ve implemented parts for this rule in #4911. As mentioned there, what’s missing
are two casesis one case:Weakly capturedselfwith explicit unwrapping according to SE-0365selfin classes when the closure isn’t@escapingTheseIt can be implemented in a later step (probably as a separate Analyzer rule). I didn’t want to make the first implementation overly complex and rather gather your feedback on other cases I might have missed.Please have a look into the PR and let me know which other test cases you can think of, what I’ve missed or what doesn’t work like the rule assumes!
bump - my team would find this rule to be super useful ❤️