mirror of
https://github.com/realm/SwiftLint.git
synced 2026-06-06 20:18:40 +00:00
3a0c2b0c05
* 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
43 lines
1.6 KiB
Swift
43 lines
1.6 KiB
Swift
public struct RuleDescription: Equatable, Codable {
|
|
public let identifier: String
|
|
public let name: String
|
|
public let description: String
|
|
public let kind: RuleKind
|
|
public let nonTriggeringExamples: [String]
|
|
public let triggeringExamples: [String]
|
|
public let corrections: [String: String]
|
|
public let deprecatedAliases: Set<String>
|
|
public let minSwiftVersion: SwiftVersion
|
|
public let requiresFileOnDisk: Bool
|
|
|
|
public var consoleDescription: String { return "\(name) (\(identifier)): \(description)" }
|
|
|
|
public var allIdentifiers: [String] {
|
|
return Array(deprecatedAliases) + [identifier]
|
|
}
|
|
|
|
public init(identifier: String, name: String, description: String, kind: RuleKind,
|
|
minSwiftVersion: SwiftVersion = .three,
|
|
nonTriggeringExamples: [String] = [], triggeringExamples: [String] = [],
|
|
corrections: [String: String] = [:],
|
|
deprecatedAliases: Set<String> = [],
|
|
requiresFileOnDisk: Bool = false) {
|
|
self.identifier = identifier
|
|
self.name = name
|
|
self.description = description
|
|
self.kind = kind
|
|
self.nonTriggeringExamples = nonTriggeringExamples
|
|
self.triggeringExamples = triggeringExamples
|
|
self.corrections = corrections
|
|
self.deprecatedAliases = deprecatedAliases
|
|
self.minSwiftVersion = minSwiftVersion
|
|
self.requiresFileOnDisk = requiresFileOnDisk
|
|
}
|
|
|
|
// MARK: Equatable
|
|
|
|
public static func == (lhs: RuleDescription, rhs: RuleDescription) -> Bool {
|
|
return lhs.identifier == rhs.identifier
|
|
}
|
|
}
|