From 12d3a13e6887e02ca2e10254d7b51019f2bfde24 Mon Sep 17 00:00:00 2001 From: Norio Nomura Date: Mon, 5 Feb 2018 13:29:05 +0900 Subject: [PATCH] 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 --- Tests/SwiftLintFrameworkTests/RuleTests.swift | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Tests/SwiftLintFrameworkTests/RuleTests.swift b/Tests/SwiftLintFrameworkTests/RuleTests.swift index 2647084ee..ec85b9d8d 100644 --- a/Tests/SwiftLintFrameworkTests/RuleTests.swift +++ b/Tests/SwiftLintFrameworkTests/RuleTests.swift @@ -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 [] } }