                                                                        length: length) ?? ""
 
         // if a trailing comma is not present
-        guard let commaIndex = trailingCommaIndex(contentsAfterLastElement, file: file,
-                                                  offset: lastPosition) else {
+        guard let commaIndex = trailingCommaIndex(contentsAfterLastElement, file: file, offset: lastPosition) else {
             guard configuration.mandatoryComma else {
                 return []
             }
 
-            return violations(file: file, byteOffset: lastPosition)
+            return violations(file: file, byteOffset: lastPosition, reason: missingTrailingCommaReason)
         }
 
         // trailing comma is present, which is a violation if mandatoryComma is false

    )

    // swiftlint:disable:next force_try
    private static let regex = try! NSRegularExpression(pattern: ",",
                                                        options: [.ignoreMetacharacters])

    public func validateFile(_ file: File,
                             kind: SwiftExpressionKind,


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()
