mirror of
https://github.com/realm/SwiftLint.git
synced 2026-06-06 20:18:40 +00:00
33 lines
1.1 KiB
Swift
33 lines
1.1 KiB
Swift
//
|
|
// SwitchCaseAlignmentRuleConfiguration.swift
|
|
// SwiftLint
|
|
//
|
|
// Created by Shai Mishali on 4/23/18.
|
|
// Copyright © 2018 Realm. All rights reserved.
|
|
//
|
|
|
|
public struct SwitchCaseAlignmentConfiguration: RuleConfiguration, Equatable {
|
|
private(set) var severityConfiguration = SeverityConfiguration(.warning)
|
|
private(set) var indentedCases = false
|
|
|
|
init() {}
|
|
|
|
public var consoleDescription: String {
|
|
return severityConfiguration.consoleDescription + ", indented cases: \(indentedCases)"
|
|
}
|
|
|
|
public mutating func apply(configuration: Any) throws {
|
|
guard let configuration = configuration as? [String: Any] else {
|
|
throw ConfigurationError.unknownConfiguration
|
|
}
|
|
|
|
self.indentedCases = configuration["indented_cases"] as? Bool ?? false
|
|
}
|
|
|
|
public static func == (lhs: SwitchCaseAlignmentConfiguration,
|
|
rhs: SwitchCaseAlignmentConfiguration) -> Bool {
|
|
return lhs.indentedCases == rhs.indentedCases &&
|
|
lhs.severityConfiguration == rhs.severityConfiguration
|
|
}
|
|
}
|