CollectingRule
public protocol CollectingRule : AnyCollectingRule
A rule that requires knowledge of all other files being linted.
-
The kind of information to collect for each file being linted for this rule.
Declaration
Swift
associatedtype FileInfo
-
collectInfo(for:
Default implementationcompilerArguments: ) Collects information for the specified file, to be analyzed by a
CollectedLinter
.Default Implementation
Declaration
Swift
func collectInfo(for file: SwiftLintFile, compilerArguments: [String]) -> FileInfo
Parameters
file
The file for which to collect info.
compilerArguments
The compiler arguments needed to compile this file.
Return Value
The collected file information.
-
Collects information for the specified file, to be analyzed by a
CollectedLinter
.Declaration
Swift
func collectInfo(for file: SwiftLintFile) -> FileInfo
Parameters
file
The file for which to collect info.
Return Value
The collected file information.
-
validate(file:
Default implementationcollectedInfo: compilerArguments: ) Executes the rule on a file after collecting file info for all files and returns any violations to the rule’s expectations.
Default Implementation
Declaration
Swift
func validate(file: SwiftLintFile, collectedInfo: [SwiftLintFile: FileInfo], compilerArguments: [String]) -> [StyleViolation]
Parameters
file
The file for which to execute the rule.
collectedInfo
All collected info for all files.
compilerArguments
The compiler arguments needed to compile this file.
Return Value
All style violations to the rule’s expectations.
-
Executes the rule on a file after collecting file info for all files and returns any violations to the rule’s expectations.
Declaration
Swift
func validate(file: SwiftLintFile, collectedInfo: [SwiftLintFile : FileInfo]) -> [StyleViolation]
Parameters
file
The file for which to execute the rule.
collectedInfo
All collected info for all files.
Return Value
All style violations to the rule’s expectations.
-
collectInfo(for:
Extension methodinto: compilerArguments: ) Declaration
Swift
func collectInfo(for file: SwiftLintFile, into storage: RuleStorage, compilerArguments: [String])
-
validate(file:
Extension methodusing: compilerArguments: ) Declaration
Swift
func validate(file: SwiftLintFile, using storage: RuleStorage, compilerArguments: [String]) -> [StyleViolation]
-
validate(file:
Extension method) Declaration
Swift
func validate(file _: SwiftLintFile) -> [StyleViolation]
-
validate(file:
Extension methodcompilerArguments: ) Declaration
Swift
func validate(file _: SwiftLintFile, compilerArguments _: [String]) -> [StyleViolation]