SubstitutionCorrectableRule
public protocol SubstitutionCorrectableRule : CorrectableRule
A correctable rule that can apply its corrections by replacing the content of ranges in the offending file with updated content.
-
Returns the NSString-based
NSRange
s to be replaced in the specified file.Declaration
Swift
func violationRanges(in file: SwiftLintFile) -> [NSRange]
Parameters
file
The file in which to find ranges of violations for this rule.
Return Value
The NSString-based
NSRange
s to be replaced in the specified file. -
Returns the substitution to apply for the given range.
Declaration
Swift
func substitution(for violationRange: NSRange, in file: SwiftLintFile) -> (NSRange, String)?
Parameters
violationRange
The NSString-based
NSRange
of the violation that should be replaced.file
The file in which the violation should be replaced.
Return Value
The range of the correction and its contents, if one could be computed.
-
correct(file:
Extension method) Declaration
Swift
func correct(file: SwiftLintFile) -> [Correction]