CollectedLinter
public struct CollectedLinter
Represents a file that can compute style violations and corrections for a list of rules.
A CollectedLinter
is only created after a Linter
has run its collection steps in Linter.collect(into:)
.
-
The file to lint with this linter.
Declaration
Swift
public let file: SwiftLintFile
-
Computes or retrieves style violations.
Declaration
Swift
public func styleViolations(using storage: RuleStorage) -> [StyleViolation]
Parameters
storage
The storage object containing all collected info.
Return Value
All style violations found by this linter.
-
Computes or retrieves style violations and the time spent executing each rule.
Declaration
Swift
public func styleViolationsAndRuleTimes(using storage: RuleStorage) -> ([StyleViolation], [(id: String, time: Double)])
Parameters
storage
The storage object containing all collected info.
Return Value
All style violations found by this linter, and the time spent executing each rule.
-
Applies corrections for all rules to this file, returning performed corrections.
Declaration
Swift
public func correct(using storage: RuleStorage) -> [Correction]
Parameters
storage
The storage object containing all collected info.
Return Value
All corrections that were applied.
-
Formats the file associated with this linter.
Declaration
Swift
public func format(useTabs: Bool, indentWidth: Int)
Parameters
useTabs
Should the file be formatted using tabs?
indentWidth
How many spaces should be used per indentation level.