Files
SwiftLint/Source/SwiftLintFramework/Models/StyleViolation.swift
T
JP Simard 3a0c2b0c05 Migrate LinterCache to use Codable models (#2799)
* Migrate LinterCache to use Codable models

improving performance and type safety

* Fix Linux

* Avoid creating a Decoder if it won't be used

For example if the file doesn't exist or can't be read.

* Use corelibs plist coder if available

It's available in the Swift 5.1 branch: https://github.com/apple/swift-corelibs-foundation/pull/1849

* Remove unused error case
2019-07-07 00:35:10 -07:00

18 lines
669 B
Swift

public struct StyleViolation: CustomStringConvertible, Equatable, Codable {
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
}
}