Skip to content

Commit d1ca304

Browse files
authored
Merge pull request #4477 from cservakt/parsing-guideline
[Refactor] Guideline stat parser
2 parents 47204df + fba39ee commit d1ca304

File tree

2 files changed

+71
-50
lines changed

2 files changed

+71
-50
lines changed

web/server/vue-cli/src/components/Statistics/Guideline/GuidelineStatistics.vue

+64-42
Original file line numberDiff line numberDiff line change
@@ -52,16 +52,22 @@
5252

5353
<div v-if="!problematicRuns.length">
5454
<v-row align="center">
55-
<v-col cols="3">
55+
<v-col cols="6">
5656
<v-select
5757
v-model="selectedGuidelineIndexes"
5858
:items="guidelineOptions"
5959
item-text="name"
6060
label="Select guidelines"
6161
outlined
6262
multiple
63-
dense
64-
/>
63+
density="comfortable"
64+
>
65+
<template v-slot:selection="{ item }">
66+
<div class="selection-item">
67+
{{ item.name }}
68+
</div>
69+
</template>
70+
</v-select>
6571
</v-col>
6672
</v-row>
6773
<guideline-statistics-table
@@ -282,6 +288,7 @@ export default {
282288
const value = [
283289
stat.guidelineName,
284290
stat.guidelineRule,
291+
stat.guidelineRuleTitle,
285292
checker.name,
286293
this.severityFromCodeToString(checker.severity),
287294
checker.enabledInAllRuns
@@ -297,7 +304,7 @@ export default {
297304
298305
const data = [
299306
[
300-
"Guideline Name", "Rule Name", "Related Checker(s)",
307+
"Guideline Name", "Rule Name", "Rule Title", "Related Checker(s)",
301308
"Checker Severity", "Checker Status", "Closed Reports",
302309
"Outstanding Reports"
303310
],
@@ -313,45 +320,53 @@ export default {
313320
this.selectedGuidelines,
314321
handleThriftError(async guidelines => {
315322
for (const [ guideline, rules ] of Object.entries(guidelines)) {
316-
guidelines[guideline] = await Promise.all(
317-
rules.map(async rule => {
318-
const checkers = await Promise.all(
319-
rule.checkers.map(async checker => {
320-
const severity = await new Promise(resolve => {
321-
ccService.getClient().getCheckerLabels(
322-
[
323-
new Checker({
324-
analyzerName: null,
325-
checkerId: checker
326-
})
327-
],
328-
handleThriftError(labels => {
329-
const severityLabels = labels[0].filter(param =>
330-
param.startsWith("severity")
331-
);
332-
const severity = severityLabels.length
333-
? severityLabels[0].split("severity:")[1]
334-
: null;
335-
resolve(severity);
336-
})
323+
const all_checkers = [];
324+
rules.forEach(rule => {
325+
rule.checkers.map(checker => {
326+
const chk = new Checker({
327+
analyzerName: null,
328+
checkerId: checker
329+
});
330+
331+
if (!all_checkers.some(
332+
c => c.checkerId === chk.checkerId)) {
333+
all_checkers.push(chk);
334+
}
335+
});
336+
});
337+
338+
const checkers_with_severity = await new Promise(resolve => {
339+
ccService.getClient().getCheckerLabels(
340+
all_checkers, handleThriftError(labels => {
341+
resolve(
342+
labels.map((label, i) => {
343+
const severityLabels = label.filter(param =>
344+
param.startsWith("severity")
337345
);
338-
});
339-
340-
return {
341-
checkerName: checker,
342-
severity: severity
343-
};
344-
})
345-
);
346-
347-
return {
348-
ruleId: rule.ruleId,
349-
title: rule.title,
350-
url: rule.url,
351-
checkers: checkers
352-
};
353-
})
354-
);
346+
return severityLabels.length
347+
? {
348+
checkerName: all_checkers[i].checkerId,
349+
severity: severityLabels[0].split("severity:")[1]
350+
}
351+
: {
352+
checkerName: all_checkers[i].checkerId,
353+
severity: null
354+
};
355+
})
356+
);
357+
})
358+
);
359+
});
360+
361+
guidelines[guideline] = rules.map(rule => {
362+
return {
363+
ruleId: rule.ruleId,
364+
title: rule.title,
365+
url: rule.url,
366+
checkers: checkers_with_severity.filter(
367+
cws => rule.checkers.includes(cws.checkerName))
368+
};
369+
});
355370
}
356371
357372
resolve(guidelines);
@@ -491,3 +506,10 @@ export default {
491506
}
492507
};
493508
</script>
509+
510+
<style scoped>
511+
.selection-item {
512+
display: block;
513+
width: 100%;
514+
}
515+
</style>

web/server/vue-cli/src/views/NewFeatures.vue

+7-8
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,9 @@
9090
example <code>CodeChecker analyze -e security command</code> is
9191
ambiguous as <code>security</code> is a checker group (all
9292
checkers starting with <code>security</code>), and a profile at
93-
the same time. Please define explicitly <code>CodeChecker -e
94-
prefix:security</code> if you mean the prefix group, or
95-
<code>profile:security</code> if you mean the security profile.
93+
the same time. Please define explicitly <code>CodeChecker -e prefix:security</code>
94+
if you mean the prefix group, or <code>profile:security</code>
95+
if you mean the security profile.
9696
</p>
9797
<p>
9898
<code>CodeChecker -e clang-diagnostic-format</code> will give an
@@ -116,8 +116,8 @@
116116
<code>guideline:</code> - to match checkers belonging to a guideline
117117
<br>
118118
<code>severity:</code> - to match checkers belonging to a given severity
119-
</p>
120-
<br>
119+
</p>
120+
<br>
121121
<p>
122122
<b>The skip file handling was changed</b>
123123
</p>
@@ -130,7 +130,7 @@
130130
By default CodeChecker used to filter out all reports from files
131131
which were on the skip list. This can hide true positive reports
132132
starting from unskipped code and ending in skipped files (typical
133-
with CTU and header related findings). This patch removes the
133+
with CTU and header related findings). This patch removes the
134134
default report filtering post processing step from
135135
<code>CodeChecker analyze --skip SKIPFILE</code> operation.
136136
The legacy functionality is still available with the
@@ -152,8 +152,7 @@
152152
<p>
153153
Clang warnings only appear as <code>clang-diagnostic-*</code>
154154
checkers and they can be enabled using the standard checker
155-
checker on/off mechanism e.g. <code>CodeChecker analyze -e
156-
clang-diagnostic-unused-function</code>
155+
checker on/off mechanism e.g. <code>CodeChecker analyze -e clang-diagnostic-unused-function</code>
157156
</p>
158157
</new-feature-item>
159158
</new-release-item>

0 commit comments

Comments
 (0)