From cbc61478eb5143e74a2ec1742d9291cf289967f9 Mon Sep 17 00:00:00 2001
From: Kamil Dudka
Date: Mon, 7 Oct 2024 14:26:32 +0200
Subject: [PATCH 1/2] writer-html: drop fallback for old scan props format
... that was obsoleted 10 years ago
Related: https://issues.redhat.com/browse/OSH-422
---
src/lib/writer-html.cc | 10 ----------
1 file changed, 10 deletions(-)
diff --git a/src/lib/writer-html.cc b/src/lib/writer-html.cc
index 29342386..07efd52b 100644
--- a/src/lib/writer-html.cc
+++ b/src/lib/writer-html.cc
@@ -139,11 +139,6 @@ void writeParseWarnings(std::ostream &str, const TScanProps &props) {
TScanProps::const_iterator itCount, itRatio;
itCount = props.find("cov-compilation-unit-count");
itRatio = props.find("cov-compilation-unit-ratio");
- if (props.end() == itCount || props.end() == itRatio) {
- // fallback to deprecated format produced by cov-mockbuild
- itCount = props.find("compilation-unit-count");
- itRatio = props.find("compilation-unit-ratio");
- }
if (props.end() == itCount || props.end() == itRatio)
return;
@@ -156,11 +151,6 @@ void writeParseWarnings(std::ostream &str, const TScanProps &props) {
itCount = props.find("diffbase-cov-compilation-unit-count");
itRatio = props.find("diffbase-cov-compilation-unit-ratio");
- if (props.end() == itCount || props.end() == itRatio) {
- // fallback to deprecated format produced by cov-mockbuild
- itCount = props.find("diffbase-compilation-unit-count");
- itRatio = props.find("diffbase-compilation-unit-ratio");
- }
if (props.end() == itCount || props.end() == itRatio)
return;
From b8aeaa2c3f209b50e910c4f3575f314c6dbe2735 Mon Sep 17 00:00:00 2001
From: Kamil Dudka
Date: Mon, 7 Oct 2024 14:40:16 +0200
Subject: [PATCH 2/2] writer-html: reword warnings about Coverity parsing
... to make them more self-explaining
Resolves: https://issues.redhat.com/browse/OSH-422
Closes: https://github.com/csutils/csdiff/pull/211
---
src/lib/writer-html.cc | 6 +++---
tests/cshtml/0001-smoke/old/scan-results.json | 2 +-
tests/cshtml/0001-smoke/scan-results.html | 8 +++++---
tests/cshtml/0001-smoke/scan-results.json | 4 ++--
4 files changed, 11 insertions(+), 9 deletions(-)
diff --git a/src/lib/writer-html.cc b/src/lib/writer-html.cc
index 07efd52b..f1ccf0a1 100644
--- a/src/lib/writer-html.cc
+++ b/src/lib/writer-html.cc
@@ -147,7 +147,7 @@ void writeParseWarnings(std::ostream &str, const TScanProps &props) {
const int ratio = boost::lexical_cast(itRatio->second);
if (ratio < parsingRatioThr)
str << "warning: "
- "low parsing ratio: " << ratio << "%
\n";
+ "low ratio of compilation units successfully parsed by Coverity: " << ratio << "%
\n";
itCount = props.find("diffbase-cov-compilation-unit-count");
itRatio = props.find("diffbase-cov-compilation-unit-ratio");
@@ -158,12 +158,12 @@ void writeParseWarnings(std::ostream &str, const TScanProps &props) {
const int baseRatio = boost::lexical_cast(itRatio->second);
if (baseRatio < parsingRatioThr && baseRatio < ratio)
str << "warning: "
- "low parsing ratio in diff base: "
+ "low ratio of compilation units successfully parsed by Coverity in diff base: "
<< baseRatio << "%
\n";
if (!count || 100 * baseCount / count < parsingOldToNewRatioThr)
str << "warning: "
- "low count of parsed units in diff base: "
+ "low count of compilation units successfully parsed by Coverity in diff base: "
<< baseCount << "
\n";
}
catch (boost::bad_lexical_cast &) {
diff --git a/tests/cshtml/0001-smoke/old/scan-results.json b/tests/cshtml/0001-smoke/old/scan-results.json
index 28fc1c0b..80731a75 100644
--- a/tests/cshtml/0001-smoke/old/scan-results.json
+++ b/tests/cshtml/0001-smoke/old/scan-results.json
@@ -5,7 +5,7 @@
"analyzer-version-cppcheck": "1.80",
"analyzer-version-gcc": "4.8.5",
"analyzer-version-shellcheck": "0.4.7",
- "cov-compilation-unit-count": 149,
+ "cov-compilation-unit-count": 49,
"cov-compilation-unit-ratio": 100,
"cov-lines-processed": 127521,
"cov-time-elapsed-analysis": "00:01:51",
diff --git a/tests/cshtml/0001-smoke/scan-results.html b/tests/cshtml/0001-smoke/scan-results.html
index 29033a2d..eba7cc70 100644
--- a/tests/cshtml/0001-smoke/scan-results.html
+++ b/tests/cshtml/0001-smoke/scan-results.html
@@ -21,6 +21,8 @@
curl-7.60.0-1.el8+7
[Show plain-text results]
+warning: low ratio of compilation units successfully parsed by Coverity: 80%
+warning: low count of compilation units successfully parsed by Coverity in diff base: 49
List of Findings
Error: SHELLCHECK_WARNING: [#def1]
@@ -1430,11 +1432,11 @@ Scan Properties
analyzer-version-cppcheck | 1.80 |
analyzer-version-gcc | 8.1.1 |
analyzer-version-shellcheck | 0.4.7 |
-cov-compilation-unit-count | 193 |
-cov-compilation-unit-ratio | 100 |
+cov-compilation-unit-count | 154 |
+cov-compilation-unit-ratio | 80 |
cov-lines-processed | 174359 |
cov-time-elapsed-analysis | 00:01:55 |
-diffbase-cov-compilation-unit-count | 149 |
+diffbase-cov-compilation-unit-count | 49 |
diffbase-cov-compilation-unit-ratio | 100 |
exit-code | 0 |
host | cov01.lab.eng.brq.redhat.com |
diff --git a/tests/cshtml/0001-smoke/scan-results.json b/tests/cshtml/0001-smoke/scan-results.json
index 5cd7cc0b..55c63d06 100644
--- a/tests/cshtml/0001-smoke/scan-results.json
+++ b/tests/cshtml/0001-smoke/scan-results.json
@@ -5,8 +5,8 @@
"analyzer-version-cppcheck": "1.80",
"analyzer-version-gcc": "8.1.1",
"analyzer-version-shellcheck": "0.4.7",
- "cov-compilation-unit-count": 193,
- "cov-compilation-unit-ratio": 100,
+ "cov-compilation-unit-count": 154,
+ "cov-compilation-unit-ratio": 80,
"cov-lines-processed": 174359,
"cov-time-elapsed-analysis": "00:01:55",
"exit-code": 0,