mirror of
https://github.com/realm/SwiftLint.git
synced 2026-05-07 20:12:49 +00:00
3f039f26d5
With the binding of configurations to their associated rule types "unknown configuration" errors can be made more specific mentioning also the rule's identifier in the printed message.
40 lines
1.5 KiB
Swift
40 lines
1.5 KiB
Swift
import SourceKittenFramework
|
|
|
|
public extension SyntaxKind {
|
|
init?(shortName: Swift.String) {
|
|
guard let kind = SyntaxKind(rawValue: "source.lang.swift.syntaxtype.\(shortName.lowercased())") else {
|
|
return nil
|
|
}
|
|
self = kind
|
|
}
|
|
|
|
static let commentAndStringKinds: Set<SyntaxKind> = commentKinds.union([.string])
|
|
|
|
static let commentKinds: Set<SyntaxKind> = [.comment, .commentMark, .commentURL,
|
|
.docComment, .docCommentField]
|
|
|
|
static let allKinds: Set<SyntaxKind> = [.argument, .attributeBuiltin, .attributeID, .buildconfigID,
|
|
.buildconfigKeyword, .comment, .commentMark, .commentURL,
|
|
.docComment, .docCommentField, .identifier, .keyword, .number,
|
|
.objectLiteral, .parameter, .placeholder, .string,
|
|
.stringInterpolationAnchor, .typeidentifier]
|
|
|
|
/// Syntax kinds that don't have associated module info when getting their cursor info.
|
|
static var kindsWithoutModuleInfo: Set<SyntaxKind> {
|
|
return [
|
|
.attributeBuiltin,
|
|
.keyword,
|
|
.number,
|
|
.docComment,
|
|
.string,
|
|
.stringInterpolationAnchor,
|
|
.attributeID,
|
|
.buildconfigKeyword,
|
|
.buildconfigID,
|
|
.commentURL,
|
|
.comment,
|
|
.docCommentField
|
|
]
|
|
}
|
|
}
|