mirror of
https://github.com/realm/SwiftLint.git
synced 2026-06-06 20:18:40 +00:00
27 lines
701 B
Swift
27 lines
701 B
Swift
//
|
|
// RuleConfiguration.swift
|
|
// SwiftLint
|
|
//
|
|
// Created by Scott Hoyt on 1/19/16.
|
|
// Copyright © 2016 Realm. All rights reserved.
|
|
//
|
|
|
|
public protocol RuleConfiguration {
|
|
var consoleDescription: String { get }
|
|
|
|
mutating func apply(configuration: Any) throws
|
|
func isEqualTo(_ ruleConfiguration: RuleConfiguration) -> Bool
|
|
}
|
|
|
|
extension RuleConfiguration {
|
|
internal var cacheDescription: String {
|
|
return (self as? CacheDescriptionProvider)?.cacheDescription ?? consoleDescription
|
|
}
|
|
}
|
|
|
|
public extension RuleConfiguration where Self: Equatable {
|
|
func isEqualTo(_ ruleConfiguration: RuleConfiguration) -> Bool {
|
|
return self == ruleConfiguration as? Self
|
|
}
|
|
}
|