RuleRegistry

public final class RuleRegistry : @unchecked Sendable

Container to register and look up SwiftLint rules.

  • Shared rule registry instance.

    Declaration

    Swift

    public static let shared: RuleRegistry
  • Rule list associated with this registry. Lazily created, and immutable once looked up.

    Note

    Adding registering more rules after this was first accessed will not work.

    Declaration

    Swift

    public private(set) lazy var list: RuleList { get set }
  • Register rules.

    Declaration

    Swift

    public func register(rules: [any Rule.Type])

    Parameters

    rules

    The rules to register.

  • Look up a rule for a given ID.

    Declaration

    Swift

    public func rule(forID id: String) -> (any Rule.Type)?

    Parameters

    id

    The ID for the rule to look up.

    Return Value

    The rule matching the specified ID, if one was found.