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.
25 lines
943 B
Swift
25 lines
943 B
Swift
struct TrailingClosureConfiguration: RuleConfiguration, Equatable {
|
|
private(set) var severityConfiguration = SeverityConfiguration(.warning)
|
|
private(set) var onlySingleMutedParameter: Bool
|
|
|
|
var consoleDescription: String {
|
|
return severityConfiguration.consoleDescription + ", only_single_muted_parameter: \(onlySingleMutedParameter)"
|
|
}
|
|
|
|
init(onlySingleMutedParameter: Bool = false) {
|
|
self.onlySingleMutedParameter = onlySingleMutedParameter
|
|
}
|
|
|
|
mutating func apply(configuration: Any) throws {
|
|
guard let configuration = configuration as? [String: Any] else {
|
|
throw ConfigurationError.unknownConfiguration
|
|
}
|
|
|
|
onlySingleMutedParameter = (configuration["only_single_muted_parameter"] as? Bool == true)
|
|
|
|
if let severityString = configuration["severity"] as? String {
|
|
try severityConfiguration.apply(configuration: severityString)
|
|
}
|
|
}
|
|
}
|