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

Closed
2 tasks done
marcelofabri opened this issue Jan 26, 2019 · 0 comments
Closed
2 tasks done

[Rule Request] Weak Computed Property #2596

marcelofabri opened this issue Jan 26, 2019 · 0 comments
Labels
rule-request Requests for a new rules.

Comments

@marcelofabri
Copy link
Collaborator

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 README.md 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 marcelofabri added the rule-request Requests for a new rules. label Jan 26, 2019
sjavora pushed 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
Labels
rule-request Requests for a new rules.
Projects
None yet
Development

No branches or pull requests

1 participant