ReasonedRuleViolation

public struct ReasonedRuleViolation : Comparable, Hashable

A violation produced by ViolationsSyntaxVisitors.

  • The correction of a violation that is basically the violation’s range in the source code and a replacement for this range that would fix the violation.

    See more

    Declaration

    Swift

    public struct ViolationCorrection : Hashable
  • The violation’s position.

    Declaration

    Swift

    public let position: AbsolutePosition
  • A specific reason for the violation.

    Declaration

    Swift

    public let reason: String?
  • The violation’s severity.

    Declaration

    Swift

    public let severity: ViolationSeverity?
  • An optional correction of the violation to be used in rewriting (see SwiftSyntaxCorrectableRule). Can be left unset when creating a violation, especially if the rule is not correctable or provides a custom rewriter.

    Declaration

    Swift

    public let correction: ViolationCorrection?
  • Creates a ReasonedRuleViolation.

    Declaration

    Swift

    public init(position: AbsolutePosition,
                reason: String? = nil,
                severity: ViolationSeverity? = nil,
                correction: ViolationCorrection? = nil)

    Parameters

    position

    The violations position in the analyzed source file.

    reason

    The reason for the violation if different from the rule’s description.

    severity

    The severity of the violation if different from the rule’s default configured severity.

    correction

    An optional correction of the violation to be used in rewriting.

  • Declaration

    Swift

    public static func < (lhs: `Self`, rhs: `Self`) -> Bool