 
 import Foundation
 import SourceKittenFramework
+
+private let missingTrailingCommaReason = "Multi-line collection literals should have trailing commas."
+private let extraTrailingCommaReason = "Collection literals should not have trailing commas."
 
 public struct TrailingCommaRule: ASTRule, ConfigurationProviderRule {
     public var configuration = TrailingCommaConfiguration()

        }

        let violationOffset = lastPosition + commaIndex
        return violations(file: file, byteOffset: violationOffset)
    }

    private func violations(file: File, byteOffset: Int) -> [StyleViolation] {
        return [
            StyleViolation(ruleDescription: type(of: self).description,
                severity: configuration.severityConfiguration.severity,
                location: Location(file: file, byteOffset: byteOffset)
            )
        ]
    }

                                                                       length: length) ?? ""

        // if a trailing comma is not present
        guard let commaIndex = trailingCommaIndex(contentsAfterLastElement, file: file, offset: lastPosition) else {
            guard configuration.mandatoryComma else {
                return []
            }

            return violations(file: file, byteOffset: lastPosition, reason: missingTrailingCommaReason)
        }

        // trailing comma is present, which is a violation if mandatoryComma is false
