Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Minor weak_delegate rule bugs #934

Closed
benasher44 opened this issue Dec 6, 2016 · 2 comments
Closed

Minor weak_delegate rule bugs #934

benasher44 opened this issue Dec 6, 2016 · 2 comments
Labels
bug Unexpected and reproducible misbehavior.

Comments

@benasher44
Copy link
Contributor

Hi there! I love the new weak_delegate rule. It's super useful! We were however able to find a couple of cases where the weak_delegate rule is erroneously calling out a var:

The first is in a protocol:

protocol P {
  var delegate: AnyObject? { get set }
}

weak is not allowed in that context, so this rule should probably skip delegate-like properties in protocols. The next is a variable that refers to a primitive:

class C {
  var delegateCalled = false // Used in the context of a test mock object
}

In both cases, there is no action in the code that can be taken to fix the issue. This can be reproduced by just dropping those 2 declarations into a file called test.swift and running swiftlint lint --path test.swift with swiftlint version 0.13.2. Thanks!

@marcelofabri
Copy link
Collaborator

I think the second one is fixed on master (#923). Could you try that?

I've reproduced the first one though. Thanks for reporting it!

@marcelofabri marcelofabri added the bug Unexpected and reproducible misbehavior. label Dec 6, 2016
@benasher44
Copy link
Contributor Author

Ah yep #923 should fix the 2nd one. Thanks!

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Unexpected and reproducible misbehavior.
Projects
None yet
Development

No branches or pull requests

2 participants