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

[Rule Request] Weak Computed Property #2596

marcelofabri opened this Issue Jan 26, 2019 · 0 comments


None yet
1 participant
Copy link

marcelofabri commented Jan 26, 2019

New Issue Checklist

New rule request

  1. Why should this rule be added? Share links to existing discussion about what
    the community thinks about this.

weak on a computed property doesn't do anything.

There are discussions about adding a warning on the compiler directly.

  1. Provide several examples of what would and wouldn't trigger violations.
class A {
    var b1: B { return B() } // ok
    weak var b2: B? // ok

    weak var b3: B? { return nil } // warning
    weak var b4: B? {  // warning
        get { return b3 }
        set { b3 = newValue }
  1. Should the rule be configurable, if so what parameters should be configurable?

Just severity

  1. Should the rule be opt-in or enabled by default? Why?
    See for guidelines on when to mark a rule as opt-in.

I think it should be enabled by default. The only reasonable case for allowing this is to document the behavior, but since it's really not enforced by the compiler I'm not sure if it's worth the possible confusion.

marcelofabri added a commit to marcelofabri/SwiftLint that referenced this issue Jan 26, 2019

sjavora added a commit to sjavora/SwiftLint that referenced this issue Mar 9, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.