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: redundant set access control #1869

Closed
2 tasks done
marcelofabri opened this issue Oct 1, 2017 · 1 comment · Fixed by #2036
Closed
2 tasks done

Rule request: redundant set access control #1869

marcelofabri opened this issue Oct 1, 2017 · 1 comment · Fixed by #2036
Labels
rule-request Requests for a new rules.

Comments

@marcelofabri
Copy link
Collaborator

marcelofabri commented Oct 1, 2017

New Issue Checklist

Rule Request

When declaring a variable, one can add a redundant ACL for setter.

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

This just adds extra noise. I don't think it's common enough for the community actively discuss it.

  1. Provide several examples of what would and wouldn't trigger violations.
class Foo {
  // should trigger
  private(set) private var bar1: Int
  internal(set) internal var bar2: Int
  internal(set) var bar3: Int // I'm not so sure about this one
  fileprivate(set) fileprivate var bar4: Int
  public(set) public var bar5: Int
  open(set) open var bar6: Int

  // shouldn't trigger
  private(set) var bar7: Int
  internal(set) public var bar8: Int
}
  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.

Enabled, as I think this is rare enough.

@marcelofabri marcelofabri added the rule-request Requests for a new rules. label Oct 1, 2017
@jpsim
Copy link
Collaborator

jpsim commented Oct 1, 2017

👍 Agreed, this might help find bugs too, since you might forget to remove an explicit setter ACL when changing the ACL of the variable.

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

Successfully merging a pull request may close this issue.

2 participants