Repository navigation
Add test count to JUnit reporter - #6319
Conversation
Generated by 🚫 Danger |
SimplyDanny
left a comment
There was a problem hiding this comment.
Thanks @nandhinisubbu! Just one small improvement ...
| static func generateReport(_ violations: [StyleViolation]) -> String { | ||
| let warningCount = violations.filter({ $0.severity == .warning }).count | ||
| let errorCount = violations.filter({ $0.severity == .error }).count | ||
| let testCount = violations.count |
There was a problem hiding this comment.
| let testCount = violations.count | |
| let testCount = warningCount + errorCount |
So separate issues always add up to the total number.
There was a problem hiding this comment.
@SimplyDanny, Does it mean, only the count of tests with severity as .warning and .error to be considered for tests count?
There was a problem hiding this comment.
The JUnit reporter is a bit strange, because JUnit is actually a testing framework. We run tests in it and they either succeed or fail (or get skipped).
Now to support this format, we need to interpret SwiftLint results as kind of tests. But we only have tests that fail. So the total number of tests is comprised by the number of issues we report, and those are either warnings or errors.
That said, violations.count is totally fine as well. Adding warnings and errors makes clearer, though, that the reporter numbers are consistent.
There was a problem hiding this comment.
Thanks for the clarification @SimplyDanny!, have pushed the changes.
Enhancement - #6161