 import Foundation
 import SourceKittenFramework
 
-public struct LetVarWhitespaceRule: OptInRule {
+public struct LetVarWhitespaceRule: ConfigurationProviderRule, OptInRule {
 
-    public var configurationDescription: String { return "" }
+    public var configuration = SeverityConfiguration(.warning)
 
     public init() {}
-    public init(configuration: Any) {}
 
     public static let description = RuleDescription(
         identifier: "let_var_whitespace",

        return violations
    }

    func linePrecedesVar(_ lineNumber: Int, _ varLines: Set<Int>, _ skippedLines: Set<Int>) -> Bool {
        return lineNeighborsVar(lineNumber, varLines, skippedLines, 1)
    }

    func lineFollowsVar(_ lineNumber: Int, _ varLines: Set<Int>, _ skippedLines: Set<Int>) -> Bool {
        return lineNeighborsVar(lineNumber, varLines, skippedLines, -1)
    }

    func lineNeighborsVar(_ lineNumber: Int, _ varLines: Set<Int>, _ skippedLines: Set<Int>, _ increment: Int) -> Bool {
        if varLines.contains(lineNumber + increment) {
            return true
        }

        return false
    }

    private func violated(_ violations: inout [StyleViolation], _ file: File, _ line: Int) {
        let content = file.lines[line].content
        let startIndex = content.rangeOfCharacter(from: CharacterSet.whitespaces.inverted)?.lowerBound
                         ?? content.startIndex
