mirror of
https://github.com/realm/SwiftLint.git
synced 2026-06-06 20:18:40 +00:00
There's no reason to expose these publicly and this will make it nicer to move to a new module outside of the core SwiftLint functionality.
29 lines
982 B
Swift
29 lines
982 B
Swift
struct ComputedAccessorsOrderRuleConfiguration: SeverityBasedRuleConfiguration, Equatable {
|
|
enum Order: String {
|
|
case getSet = "get_set"
|
|
case setGet = "set_get"
|
|
}
|
|
|
|
private(set) var severityConfiguration = SeverityConfiguration(.warning)
|
|
private(set) var order = Order.getSet
|
|
|
|
var consoleDescription: String {
|
|
return [severityConfiguration.consoleDescription, "order: \(order.rawValue)"].joined(separator: ", ")
|
|
}
|
|
|
|
mutating func apply(configuration: Any) throws {
|
|
guard let configuration = configuration as? [String: Any] else {
|
|
throw ConfigurationError.unknownConfiguration
|
|
}
|
|
|
|
if let orderString = configuration["order"] as? String,
|
|
let order = Order(rawValue: orderString) {
|
|
self.order = order
|
|
}
|
|
|
|
if let severityString = configuration["severity"] as? String {
|
|
try severityConfiguration.apply(configuration: severityString)
|
|
}
|
|
}
|
|
}
|