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
NSRanges to be replaced in the specified file.Declaration
Swift
func violationRanges(in file: SwiftLintFile) -> [NSRange]Parameters
fileThe file in which to find ranges of violations for this rule.
Return Value
The NSString-based
NSRanges 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
violationRangeThe NSString-based
NSRangeof the violation that should be replaced.fileThe 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) -> Int
View on GitHub
Install in Dash