Files
SwiftLint/Source/SwiftLintFramework/Rules/RuleConfigurations/ForWhereRuleConfiguration.swift
T
JP SimardandGitHub 4bd7da32ea Reduce visibility of rules to be internal (#4533)
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.
2022-11-09 11:01:26 -05:00

21 lines
791 B
Swift

struct ForWhereRuleConfiguration: SeverityBasedRuleConfiguration, Equatable {
private(set) var severityConfiguration = SeverityConfiguration(.warning)
private(set) var allowForAsFilter = false
var consoleDescription: String {
return severityConfiguration.consoleDescription + ", allow_for_as_filter: \(allowForAsFilter)"
}
mutating func apply(configuration: Any) throws {
guard let configuration = configuration as? [String: Any] else {
throw ConfigurationError.unknownConfiguration
}
allowForAsFilter = configuration["allow_for_as_filter"] as? Bool ?? false
if let severityString = configuration["severity"] as? String {
try severityConfiguration.apply(configuration: severityString)
}
}
}