Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

writer-html: reword warnings about Coverity parsing #211

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
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
16 changes: 3 additions & 13 deletions src/lib/writer-html.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -152,28 +147,23 @@ void writeParseWarnings(std::ostream &str, const TScanProps &props) {
const int ratio = boost::lexical_cast<float>(itRatio->second);
if (ratio < parsingRatioThr)
str << "<p><b class='parseWarning'>warning:</b> "
"low parsing ratio: " << ratio << "%</p>\n";
"low ratio of compilation units successfully parsed by Coverity: " << ratio << "%</p>\n";

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;

const int baseCount = boost::lexical_cast<int>(itCount->second);
const int baseRatio = boost::lexical_cast<float>(itRatio->second);
if (baseRatio < parsingRatioThr && baseRatio < ratio)
str << "<p><b class='parseWarning'>warning:</b> "
"low parsing ratio in diff base: "
"low ratio of compilation units successfully parsed by Coverity in diff base: "
<< baseRatio << "%</p>\n";

if (!count || 100 * baseCount / count < parsingOldToNewRatioThr)
str << "<p><b class='parseWarning'>warning:</b> "
"low count of parsed units in diff base: "
"low count of compilation units successfully parsed by Coverity in diff base: "
<< baseCount << "</p>\n";
}
catch (boost::bad_lexical_cast &) {
Expand Down
2 changes: 1 addition & 1 deletion tests/cshtml/0001-smoke/old/scan-results.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
8 changes: 5 additions & 3 deletions tests/cshtml/0001-smoke/scan-results.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
<body>
<h1>curl-7.60.0-1.el8+7</h1>
<a href='scan-results.err'>[Show plain-text results]</a>
<p><b class='parseWarning'>warning:</b> low ratio of compilation units successfully parsed by Coverity: 80%</p>
<p><b class='parseWarning'>warning:</b> low count of compilation units successfully parsed by Coverity in diff base: 49</p>
<h2>List of Findings</h2>
<pre>
<a id='def1'></a><b>Error: <span class='checker'>SHELLCHECK_WARNING</span>:</b> <a href='#def1'>[#def1]</a>
Expand Down Expand Up @@ -1430,11 +1432,11 @@ <h2>Scan Properties</h2>
<tr class='oddRow'><td class='scanPropName'>analyzer-version-cppcheck</td><td>1.80</td></tr>
<tr><td class='scanPropName'>analyzer-version-gcc</td><td>8.1.1</td></tr>
<tr class='oddRow'><td class='scanPropName'>analyzer-version-shellcheck</td><td>0.4.7</td></tr>
<tr><td class='scanPropName'>cov-compilation-unit-count</td><td>193</td></tr>
<tr class='oddRow'><td class='scanPropName'>cov-compilation-unit-ratio</td><td>100</td></tr>
<tr><td class='scanPropName'>cov-compilation-unit-count</td><td>154</td></tr>
<tr class='oddRow'><td class='scanPropName'>cov-compilation-unit-ratio</td><td>80</td></tr>
<tr><td class='scanPropName'>cov-lines-processed</td><td>174359</td></tr>
<tr class='oddRow'><td class='scanPropName'>cov-time-elapsed-analysis</td><td>00:01:55</td></tr>
<tr><td class='scanPropName'>diffbase-cov-compilation-unit-count</td><td>149</td></tr>
<tr><td class='scanPropName'>diffbase-cov-compilation-unit-count</td><td>49</td></tr>
<tr class='oddRow'><td class='scanPropName'>diffbase-cov-compilation-unit-ratio</td><td>100</td></tr>
<tr><td class='scanPropName'>exit-code</td><td>0</td></tr>
<tr class='oddRow'><td class='scanPropName'>host</td><td>cov01.lab.eng.brq.redhat.com</td></tr>
Expand Down
4 changes: 2 additions & 2 deletions tests/cshtml/0001-smoke/scan-results.json
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Loading