Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@
[ahmadalfy](https://github.com/ahmadalfy)
[#6499](https://github.com/realm/SwiftLint/issues/6499)

* Add `name` on JUnit `testsuite` output and include a `line` attribute on
each `failure` element for better CI parser compatibility.
[theamodhshetty](https://github.com/theamodhshetty)
[#6161](https://github.com/realm/SwiftLint/issues/6161)

### Bug Fixes

* Ensure that disable commands work for `redundant_nil_coalescing` rule.
Expand Down
4 changes: 2 additions & 2 deletions Source/SwiftLintFramework/Reporters/JUnitReporter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ struct JUnitReporter: Reporter {
return """
<?xml version="1.0" encoding="utf-8"?>
<testsuites failures="\(warningCount)" errors="\(errorCount)" tests="\(testCount)">
\t<testsuite failures="\(warningCount)" errors="\(errorCount)" tests="\(testCount)">
\t<testsuite name="SwiftLint" failures="\(warningCount)" errors="\(errorCount)" tests="\(testCount)">
\(violations.map(testCase(for:)).joined(separator: "\n"))
\t</testsuite>
</testsuites>
Expand All @@ -32,7 +32,7 @@ struct JUnitReporter: Reporter {

return """
\t\t<testcase classname='Formatting Test' name='\(fileName)'>
\t\t\t<failure message='\(reason)'>\(message)</failure>
\t\t\t<failure message='\(reason)' line='\(lineNumber)'>\(message)</failure>
\t\t</testcase>
"""
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<testsuites failures="1" errors="3" tests="4">
Comment thread
SimplyDanny marked this conversation as resolved.
Outdated
<testsuite failures="1" errors="3" tests="4">
<testsuite name="SwiftLint" failures="1" errors="3" tests="4">
<testcase classname='Formatting Test' name='filename'>
<failure message='Violation Reason 1'>Warning:Line:1</failure>
<failure message='Violation Reason 1' line='1'>Warning:Line:1</failure>
</testcase>
<testcase classname='Formatting Test' name='filename'>
<failure message='Violation Reason 2'>Error:Line:1</failure>
<failure message='Violation Reason 2' line='1'>Error:Line:1</failure>
</testcase>
<testcase classname='Formatting Test' name='${CURRENT_WORKING_DIRECTORY}/path/file.swift'>
<failure message='Shorthand syntactic sugar should be used, i.e. [Int] instead of Array&lt;Int&gt;'>Error:Line:1</failure>
<failure message='Shorthand syntactic sugar should be used, i.e. [Int] instead of Array&lt;Int&gt;' line='1'>Error:Line:1</failure>
Comment thread
SimplyDanny marked this conversation as resolved.
Outdated
</testcase>
<testcase classname='Formatting Test' name='&lt;nopath&gt;'>
<failure message='Colons should be next to the identifier when specifying a type and next to the key in dictionary literals'>Error:Line:0</failure>
<failure message='Colons should be next to the identifier when specifying a type and next to the key in dictionary literals' line='0'>Error:Line:0</failure>
</testcase>
</testsuite>
</testsuites>