-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
unused_closure_parameter false positive on lazy var #1161
Comments
Thanks for reporting this. |
It would be nice to have kind of a tutor to fix on my own :)
…--
Ignazio Calo'
On 11 January 2017 at 18:43:32, JP Simard ***@***.***) wrote:
Thanks for reporting this.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#1161 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAnaUyShMTx1wqqcjmJslE0zao4uJW-Lks5rRRTEgaJpZM4LgirT>
.
|
Some tips to debug this in SwiftLint yourself:
|
You can also add your example to the rule examples. Another useful thing might be updating the rule to conform to |
Another tip is using SourceKitten to get the information about your example so you can understand the problem better. |
Thanks for the suggestions. I was able to debug the issue and investigate a little bit using This is the test input: 3.times { number in
number
}
{ ( lbl: UILabel) -> UILabel in
lbl
}(obj)
Here the relevant output from SourceKitten:
On the first example the closure's body can be found between Unfortunately on the second example the same indexes point outside of the definition of the closure, to the call ( The first solution coming to my mind is to check if the Thanks! |
I think it's hacky to try to use IMHO, we should just detect this case (i.e. detect that |
After all, this rule doesn't work with closure declarations as well (see #1082). |
Not to hijack this thread, but a number of the suggestions given should probably be added to the |
agree.
…On 16 January 2017 at 10:20, Aaron McTavish ***@***.***> wrote:
Not to hijack this thread, but a number of the suggestions given should
probably be added to the CONTRIBUTING.md file to help future contributors.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#1161 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAnaUyUVziuD6463OHJ1B8U59C8snI3Fks5rSzZugaJpZM4LgirT>
.
|
When a closure is used in this way,
swiftlint
raise a warning about the variablelbl
not being used.The text was updated successfully, but these errors were encountered: