-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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: explicit access control level #1649
Comments
Do you have any examples on how explicit non top level declarations would benefit from this requested rule? |
I don't have any specific examples; this is just more of a personal preference that I like to follow when developing frameworks. It gives more context to anything that you're looking at within the library. |
+1 because I'm a fan of this opinion:
|
@mshibanami but adding them to the top level declarations should be enough to cover that case |
internal class Hello {
let v = "world"
} In this case, I think it would be nice if SwiftLint warns me about I'm sorry if I misunderstood. |
That rule won't trigger a violation because it only validates top level declarations (as I actually got your point now. Sorry for adding noise to the conversation. |
+1 to this. I've seen many Swift codebases that neglect using ACLs in the internals of a class/enum/struct. I'm unsure why this is so pervasive specifically on iOS, but I'd prefer to ensure that my team does not neglect something as crucial as class encapsulation. My concern on class encapsulation is due to Swift defaulting to In summary, adding this rule would improve the health of any codebase that opts in, so I'm a bit surprised it's not already baked in. |
@joseprl89 since you appear to feel strongly about this, perhaps you're motivated enough to contribute this rule to SwiftLint yourself? I'm happy to provide guidance if you get stuck. |
Add explicit acl rule to satisfy Issue #1649
Done in #1966. |
See title
I know there is a rule for top level ACL declarations, but one for all declarations would be nice. This would probably be opt-in, as it would mostly be useful by frameworks and not applications.
The text was updated successfully, but these errors were encountered: