mirror of
https://github.com/realm/SwiftLint.git
synced 2026-06-06 20:18:40 +00:00
b83e0991b9
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.
27 lines
921 B
Swift
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
|
|
}
|