ViolationsSyntaxRewriter

open class ViolationsSyntaxRewriter<Configuration> : SyntaxRewriter where Configuration : RuleConfiguration

A SwiftSyntax SyntaxRewriter that produces absolute positions where corrections were applied.

  • A rule’s configuration.

    Declaration

    Swift

    public let configuration: Configuration
  • The file from which the traversed syntax tree stems from.

    Declaration

    Swift

    public let file: SwiftLintFile
  • A converter of positions in the traversed source file.

    Declaration

    Swift

    public lazy var locationConverter: SourceLocationConverter { get set }
  • The regions in the traversed file that are disabled by a command.

    Declaration

    Swift

    public lazy var disabledRegions: [SourceRange] { get set }
  • The number of corrections made by the rewriter.

    Declaration

    Swift

    public var numberOfCorrections: Int
  • Initializer for a ViolationsSyntaxRewriter.

    Declaration

    Swift

    @inlinable
    public init(configuration: Configuration, file: SwiftLintFile)

    Parameters

    configuration

    Configuration of a rule.

    file

    File from which the syntax tree stems from.

  • Determines whether the rule is disabled at the start position of the given syntax node.

    Declaration

    Swift

    public func isDisabled(atStartPositionOf node: some SyntaxProtocol) -> Bool

    Parameters

    node

    The syntax node to check.

    Return Value

    true if the rule is disabled for the node.

  • Declaration

    Swift

    override open func visitAny(_ node: Syntax) -> Syntax?