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:compilerArguments:) Default implementation

    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.

  • 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.

== Implementations