ASTRule
public protocol ASTRule : Rule
A rule that leverages the Swift source’s pre-typechecked Abstract Syntax Tree to recurse into the source’s structure, validating the rule recursively in nested source bodies.
-
The kind of token being recursed over.
Declaration
Swift
associatedtype KindType : RawRepresentable -
Executes the rule on a file and a subset of its AST structure, returning any violations to the rule’s expectations.
Declaration
Swift
func validate(file: SwiftLintFile, kind: KindType, dictionary: SourceKittenDictionary) -> [StyleViolation]Parameters
fileThe file for which to execute the rule.
kindThe kind of token being recursed over.
dictionaryThe dictionary for an AST subset to validate.
Return Value
All style violations to the rule’s expectations.
-
Get the
kindfrom the specified dictionary.Declaration
Swift
func kind(from dictionary: SourceKittenDictionary) -> KindType?Parameters
dictionaryThe
SourceKittenDictionaryrepresenting the source structure from which to extract thekind.Return Value
The
kindfrom the specified dictionary, if one was found. -
validate(file:Extension method) Declaration
Swift
func validate(file: SwiftLintFile) -> [StyleViolation] -
validate(file:Extension methoddictionary: ) Executes the rule on a file and a subset of its AST structure, returning any violations to the rule’s expectations.
Declaration
Swift
func validate(file: SwiftLintFile, dictionary: SourceKittenDictionary) -> [StyleViolation]Parameters
fileThe file for which to execute the rule.
dictionaryThe dictionary for an AST subset to validate.
Return Value
All style violations to the rule’s expectations.
-
kind(from:Default implementation) Default Implementation
Declaration
Swift
func kind(from dictionary: SourceKittenDictionary) -> KindType?
-
kind(from:Default implementation) Default Implementation
Declaration
Swift
func kind(from dictionary: SourceKittenDictionary) -> KindType?
-
kind(from:Default implementation) Default Implementation
Declaration
Swift
func kind(from dictionary: SourceKittenDictionary) -> KindType?
View on GitHub
Install in Dash