mirror of
https://github.com/realm/SwiftLint.git
synced 2026-06-06 20:18:40 +00:00
24 lines
862 B
Swift
24 lines
862 B
Swift
import SwiftLintCore
|
|
|
|
struct FileNameNoSpaceConfiguration: SeverityBasedRuleConfiguration, Equatable {
|
|
typealias Parent = FileNameNoSpaceRule
|
|
|
|
@ConfigurationElement(key: "severity")
|
|
private(set) var severityConfiguration = SeverityConfiguration<Parent>.warning
|
|
@ConfigurationElement(key: "excluded")
|
|
private(set) var excluded = Set<String>()
|
|
|
|
mutating func apply(configuration: Any) throws {
|
|
guard let configurationDict = configuration as? [String: Any] else {
|
|
throw Issue.unknownConfiguration(ruleID: Parent.identifier)
|
|
}
|
|
|
|
if let severity = configurationDict[$severityConfiguration] {
|
|
try severityConfiguration.apply(configuration: severity)
|
|
}
|
|
if let excluded = [String].array(of: configurationDict[$excluded]) {
|
|
self.excluded = Set(excluded)
|
|
}
|
|
}
|
|
}
|