                                                                        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

        }

        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)
            )
        ]
    }

    )

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

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