Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Optionally disallow access modifier override on extensions #1457

Closed
masters3d opened this issue Apr 23, 2017 · 1 comment
Closed

Optionally disallow access modifier override on extensions #1457

masters3d opened this issue Apr 23, 2017 · 1 comment
Labels
rule-request Requests for a new rules.

Comments

@masters3d
Copy link
Contributor

masters3d commented Apr 23, 2017

Instead of

private extension SomeType {
    func someFuncA() {}
}

Prefer

extension SomeType {
    fileprivate func someFuncA() {}
}
@masters3d
Copy link
Contributor Author

Find all the occurrences of extension in the structure:
"key.kind" : "source.lang.swift.decl.extension"
then we could find out if there is a syntax type before the extension:
"type" : "source.lang.swift.syntaxtype.attribute.builtin"
then we check if the built in attribute is any of the access modifier;
If true, then we can mark the violation.

# for free to join this conversation on GitHub. Already have an account? # 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