Handle extensions
This commit is contained in:
parent
f81e28c574
commit
ce212e745e
|
@ -68,6 +68,13 @@ public struct ExplicitACLRule: SwiftSyntaxRule, OptInRule, ConfigurationProvider
|
|||
}
|
||||
}
|
||||
}
|
||||
"""),
|
||||
Example("""
|
||||
private extension Foo {
|
||||
var isValid: Bool {
|
||||
true
|
||||
}
|
||||
}
|
||||
""")
|
||||
],
|
||||
triggeringExamples: [
|
||||
|
@ -100,7 +107,7 @@ private extension ExplicitACLRule {
|
|||
SubscriptDeclSyntax.self,
|
||||
VariableDeclSyntax.self,
|
||||
ProtocolDeclSyntax.self,
|
||||
InitializerDeclSyntax.self,
|
||||
InitializerDeclSyntax.self
|
||||
]
|
||||
}
|
||||
|
||||
|
@ -178,6 +185,15 @@ private extension ExplicitACLRule {
|
|||
}
|
||||
}
|
||||
|
||||
override func visit(_ node: ExtensionDeclSyntax) -> SyntaxVisitorContinueKind {
|
||||
guard let modifiers = node.modifiers,
|
||||
modifiers.contains(where: \.isACLModifier) else {
|
||||
return .visitChildren
|
||||
}
|
||||
|
||||
return .skipChildren
|
||||
}
|
||||
|
||||
override func visit(_ node: CodeBlockSyntax) -> SyntaxVisitorContinueKind {
|
||||
.skipChildren
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue