skip Principle Class
This commit is contained in:
parent
ac399e4418
commit
f8ab5fa941
|
@ -7,4 +7,5 @@ public enum RuleType: String, Decodable, CaseIterable {
|
|||
case attributes
|
||||
case xml
|
||||
case comment
|
||||
case superClass = "super_class"
|
||||
}
|
||||
|
|
|
@ -39,6 +39,7 @@ let blacklistSources: [SourceDetail] = [SourceDetail(name: "AppDelegate", source
|
|||
SourceDetail(name: "viewWillAppear(_:)", sourceKind: .function),
|
||||
SourceDetail(name: "viewWillDisappear(_:)", sourceKind: .function),
|
||||
SourceDetail(name: "viewDidDisappear(_:)", sourceKind: .function),
|
||||
SourceDetail(name: "CodingKeys", sourceKind: .enum)
|
||||
SourceDetail(name: "CodingKeys", sourceKind: .enum),
|
||||
SourceDetail(name: "NotificationService", sourceKind: .class)
|
||||
]
|
||||
|
||||
|
|
|
@ -26,6 +26,8 @@ struct RuleFactory {
|
|||
return XMLRule()
|
||||
case .comment:
|
||||
return CommentRule()
|
||||
case .superClass:
|
||||
return SuperClassRule()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
import Foundation
|
||||
import SwiftSyntax
|
||||
|
||||
/// Skip class inherited from specific class
|
||||
struct SuperClassRule: SourceCollectRule {
|
||||
|
||||
static let blacklist: [String] = ["NotificationService",
|
||||
"PreviewProvider"]
|
||||
|
||||
func skip(_ node: Syntax) -> Bool {
|
||||
if let node = node as? InheritableSyntax {
|
||||
if SuperClassRule.blacklist.contains(where: node.isInherited(from:)) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue