CorrectableRule

public protocol CorrectableRule : Rule

A rule that can correct violations.

  • correct(file:compilerArguments:) Default implementation

    Attempts to correct the violations to this rule in the specified file.

    Default Implementation

    Declaration

    Swift

    func correct(file: SwiftLintFile, compilerArguments: [String]) -> [Correction]

    Parameters

    file

    The file for which to correct violations.

    compilerArguments

    The compiler arguments needed to compile this file.

    Return Value

    All corrections that were applied.

  • Attempts to correct the violations to this rule in the specified file.

    Declaration

    Swift

    func correct(file: SwiftLintFile) -> [Correction]

    Parameters

    file

    The file for which to correct violations.

    Return Value

    All corrections that were applied.

  • Attempts to correct the violations to this rule in the specified file after collecting file info for all files and returns all corrections that were applied.

    Note

    This function is called by the linter and is always implemented in extensions.

    Default Implementation

    Declaration

    Swift

    func correct(file: SwiftLintFile, using storage: RuleStorage, compilerArguments: [String]) -> [Correction]

    Parameters

    file

    The file for which to execute the rule.

    storage

    The storage object containing all collected info.

    compilerArguments

    The compiler arguments needed to compile this file.

    Return Value

    All corrections that were applied.