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] If all extension members are the same suggest extension modifier instead. #1546

Closed
masters3d opened this issue May 23, 2017 · 0 comments
Labels
rule-request Requests for a new rules.

Comments

@masters3d
Copy link
Contributor

masters3d commented May 23, 2017

If all declarations in an extension have the same ACL, the ACL should be in the extension itself.

extension Int {
    fileprivate func someFunc1(){}
    fileprivate func someFunc2(){}
    fileprivate func someFunc3(){}
}
//suggest
private extension Int { 
    func someFunc1(){} 
    func someFunc2(){} 
    func someFunc3(){}
}

Do not suggest when:

  • all members of the extension are private [1]
  • all members are the same but there is already an extension modifier
  • all members are internal

[1] A private modifier on the extension effectively turns all members into fileprivate access.

reference:
#1543

@marcelofabri marcelofabri added the rule-request Requests for a new rules. label May 23, 2017
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

2 participants