Files
SwiftLint/Source/SwiftLintFramework/Models/StyleViolation.swift
T
JP Simard b83e0991b9 Remove all file headers
The MIT license doesn't require that all files be prepended with this
licensing or copyright information. Realm confirmed that they're ok with this
change. This will enable some companies to contribute to SwiftLint and the
date & authorship information will remain accessible via git source control.
2018-05-04 13:42:02 -07:00

27 lines
921 B
Swift

public struct StyleViolation: CustomStringConvertible, Equatable {
public let ruleDescription: RuleDescription
public let severity: ViolationSeverity
public let location: Location
public let reason: String
public var description: String {
return XcodeReporter.generateForSingleViolation(self)
}
public init(ruleDescription: RuleDescription, severity: ViolationSeverity = .warning,
location: Location, reason: String? = nil) {
self.ruleDescription = ruleDescription
self.severity = severity
self.location = location
self.reason = reason ?? ruleDescription.description
}
}
// MARK: Equatable
public func == (lhs: StyleViolation, rhs: StyleViolation) -> Bool {
return lhs.ruleDescription == rhs.ruleDescription &&
lhs.location == rhs.location &&
lhs.severity == rhs.severity &&
lhs.reason == rhs.reason
}