Silence compiler warnings

> warning: initializer 'init(configuration:)' nearly matches defaulted requirement 'init(configuration:)' of protocol 'Rule'
> note: candidate has non-matching type '(configuration: SeverityLevelsConfiguration)'
> note: move 'init(configuration:)' to an extension to silence this warning
> SwiftLintFramework.Rule:5:12: note: requirement 'init(configuration:)' declared here
>    public init(configuration: Any) throws
This commit is contained in:
Norio Nomura
2018-02-05 13:29:05 +09:00
parent 059ee7be94
commit 12d3a13e68
@@ -19,6 +19,12 @@ struct RuleWithLevelsMock: ConfigurationProviderRule {
kind: .style,
deprecatedAliases: ["mock"])
init() {}
init(configuration: Any) throws {
self.init()
try self.configuration.apply(configuration: configuration)
}
func validate(file: File) -> [StyleViolation] { return [] }
}
@@ -56,6 +62,12 @@ class RuleTests: XCTestCase {
name: "",
description: "", kind: .style)
init() {}
init(configuration: Any) throws {
self.init()
try self.configuration.apply(configuration: configuration)
}
func validate(file: File) -> [StyleViolation] { return [] }
}