diff --git a/CHANGELOG.md b/CHANGELOG.md index caee6d039..5834a7fd6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,10 @@ [nandhinisubbu](https://github.com/nandhinisubbu) [#6164](https://github.com/realm/SwiftLint/issues/6164) +* Add test count to JUnit reporter. + [nandhinisubbu](https://github.com/nandhinisubbu) + [#6161](https://github.com/realm/SwiftLint/issues/6161) + ### Bug Fixes * Fix false positive with `#Preview` macro in `closure_end_indentation` rule. diff --git a/Source/SwiftLintFramework/Reporters/JUnitReporter.swift b/Source/SwiftLintFramework/Reporters/JUnitReporter.swift index 9fb1f73a7..c40066fb1 100644 --- a/Source/SwiftLintFramework/Reporters/JUnitReporter.swift +++ b/Source/SwiftLintFramework/Reporters/JUnitReporter.swift @@ -11,11 +11,12 @@ struct JUnitReporter: Reporter { static func generateReport(_ violations: [StyleViolation]) -> String { let warningCount = violations.filter({ $0.severity == .warning }).count let errorCount = violations.filter({ $0.severity == .error }).count + let testCount = warningCount + errorCount return """ - - \t + + \t \(violations.map(testCase(for:)).joined(separator: "\n")) \t diff --git a/Tests/FileSystemAccessTests/Resources/CannedJunitReporterOutput.xml b/Tests/FileSystemAccessTests/Resources/CannedJunitReporterOutput.xml index b786f1f1f..5c75dced0 100644 --- a/Tests/FileSystemAccessTests/Resources/CannedJunitReporterOutput.xml +++ b/Tests/FileSystemAccessTests/Resources/CannedJunitReporterOutput.xml @@ -1,6 +1,6 @@ - - + + Warning:Line:1