Skip to content

Commit fa306fc

Browse files
committed
Improve performance of SonarQube reporter handling passing assertions
This mirrors the changes done to the JUnit reporter in commit fe483c0
1 parent 35c3403 commit fa306fc

File tree

4 files changed

+311
-3
lines changed

4 files changed

+311
-3
lines changed

src/catch2/reporters/catch_reporter_sonarqube.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,9 @@ namespace Catch {
7373
if (!rootName.empty())
7474
name = rootName + '/' + name;
7575

76-
if ( sectionNode.hasAnyAssertions()
76+
if ( sectionNode.stats.assertions.total() > 0
7777
|| !sectionNode.stdOut.empty()
78-
|| !sectionNode.stdErr.empty() ) {
78+
|| !sectionNode.stdErr.empty() ) {
7979
XmlWriter::ScopedElement e = xml.scopedElement("testCase");
8080
xml.writeAttribute("name"_sr, name);
8181
xml.writeAttribute("duration"_sr, static_cast<long>(sectionNode.stats.durationInSeconds * 1000));

src/catch2/reporters/catch_reporter_sonarqube.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ namespace Catch {
2121
: CumulativeReporterBase(CATCH_MOVE(config))
2222
, xml(m_stream) {
2323
m_preferences.shouldRedirectStdOut = true;
24-
m_preferences.shouldReportAllAssertions = true;
24+
m_preferences.shouldReportAllAssertions = false;
2525
m_shouldStoreSuccesfulAssertions = false;
2626
}
2727

0 commit comments

Comments
 (0)