mirror of
https://github.com/realm/SwiftLint.git
synced 2026-06-06 20:18:40 +00:00
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:
@@ -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 [] }
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user