StyleViolation
public struct StyleViolation : CustomStringConvertible, Codable, Hashable
A value describing an instance of Swift source code that is considered invalid by a SwiftLint rule.
-
The identifier of the rule that generated this violation.
Declaration
Swift
public let ruleIdentifier: String
-
The description of the rule that generated this violation.
Declaration
Swift
public let ruleDescription: String
-
The name of the rule that generated this violation.
Declaration
Swift
public let ruleName: String
-
The severity of this violation.
Declaration
Swift
public private(set) var severity: ViolationSeverity { get }
-
The location of this violation.
Declaration
Swift
public private(set) var location: Location { get }
-
The justification for this violation.
Declaration
Swift
public let reason: String
-
A printable description for this violation.
Declaration
Swift
public var description: String { get }
-
Creates a
StyleViolation
by specifying its properties directly.Declaration
Swift
public init(ruleDescription: RuleDescription, severity: ViolationSeverity = .warning, location: Location, reason: String? = nil)
Parameters
ruleDescription
The description of the rule that generated this violation.
severity
The severity of this violation.
location
The location of this violation.
reason
The justification for this violation. If not specified the rule’s description will be used.
-
Returns the same violation, but with the
severity
that is passed inDeclaration
Swift
public func with(severity: ViolationSeverity) -> StyleViolation
Parameters
severity
the new severity to use in the modified violation
-
Declaration
Swift
public func hash(into hasher: inout Hasher)