Skip to content

Commit

Permalink
[feat] Showing closed reports on Checker Coverage tab
Browse files Browse the repository at this point in the history
It is an additional PR for Checker Coverage tab to list closed reports not just outstandings. The number of closed report can be clickable for the user if it is not zero.

Achieving this, it is necessary to add a report status filter to the report filter section that has two options: OUTSTANDING and CLOSED. A report is outstanding when its review status is unreviewed/confirmed and its detaction status is new/unresolved/reopened. When the new filter is set, the review and the detection status filters are not taken into account.
  • Loading branch information
cservakt committed May 8, 2024
1 parent 15088df commit 8c1b43b
Show file tree
Hide file tree
Showing 11 changed files with 184 additions and 12 deletions.
2 changes: 1 addition & 1 deletion web/api/js/codechecker-api-node/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "codechecker-api",
"version": "6.57.0",
"version": "6.58.0",
"description": "Generated node.js compatible API stubs for CodeChecker server.",
"main": "lib",
"homepage": "https://github.com/Ericsson/codechecker",
Expand Down
2 changes: 1 addition & 1 deletion web/api/py/codechecker_api/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
with open('README.md', encoding='utf-8', errors="ignore") as f:
long_description = f.read()

api_version = '6.57.0'
api_version = '6.58.0'

setup(
name='codechecker_api',
Expand Down
2 changes: 1 addition & 1 deletion web/api/py/codechecker_api_shared/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
with open('README.md', encoding='utf-8', errors="ignore") as f:
long_description = f.read()

api_version = '6.57.0'
api_version = '6.58.0'

setup(
name='codechecker_api_shared',
Expand Down
19 changes: 19 additions & 0 deletions web/api/report_server.thrift
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,15 @@ enum Order {
DESC
}

/**
* Report status can show the current status of the report
* that depends on the review and thedetection status.
*/
enum ReportStatus {
OUTSTANDING, // The report is outstanding according to the review- and the detection status.
CLOSED, // The report is not a valid bug according to the review- and the detection status.
}

/**
* Review status is a feature which allows a user to assign one of these
* statuses to a particular Report.
Expand Down Expand Up @@ -826,6 +835,16 @@ service codeCheckerDBAccess {
5: i64 offset)
throws (1: codechecker_api_shared.RequestFailed requestError),

// getReporStatusCounts returns ReporStatus-count pairs
// to show the number of outstanding and closed reports.
// If the run id list is empty the metrics will be
// counted for all of the runs.
// PERMISSION: PRODUCT_VIEW
map<ReporStatus, i64> getReporStatusCounts(1: list<i64> runIds,
2: ReportFilter reportFilter,
3: CompareData cmpData)
throws (1: codechecker_api_shared.RequestFailed requestError),

// If the run id list is empty the metrics will be counted
// for all of the runs and in compare mode all of the runs
// will be used as a baseline excluding the runs in compare data.
Expand Down
2 changes: 1 addition & 1 deletion web/codechecker_web/shared/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
# The newest supported minor version (value) for each supported major version
# (key) in this particular build.
SUPPORTED_VERSIONS = {
6: 57
6: 58
}

# Used by the client to automatically identify the latest major and minor
Expand Down
22 changes: 20 additions & 2 deletions web/server/codechecker_server/api/report_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,12 +301,30 @@ def process_report_filter(

AND.append(or_(*OR))

if report_filter.detectionStatus:
if report_filter.reportStatus:
# DetectionStatus.NEW DetectionStatus.RESOLVED DetectionStatus.UNRESOLVED DetectionStatus.REOPENED DetectionStatus.OFF DetectionStatus.UNAVAILABLE:
# ReviewStatus.UNREVIEWED ReviewStatus.CONFIRMED ReviewStatus.FALSE_POSITIVE ReviewStatus.INTENTIONAL:
dst = list(map(detection_status_str,
(DetectionStatus.NEW,
DetectionStatus.UNRESOLVED,
DetectionStatus.REOPENED)))
rst = list(map(review_status_str,
(ReviewStatus.UNREVIEWED,
ReviewStatus.CONFIRMED)))

if report_filter.reportStatus.isOutstanding:
AND.append(and_(Report.review_status.in_(rst), Report.detection_status.in_(dst)))

if report_filter.reportStatus.isClosed:
AND.append(not_(and_(Report.review_status.in_(rst), Report.detection_status.in_(dst))))
print(*AND)

if report_filter.detectionStatus and not report_filter.reportStatus:
dst = list(map(detection_status_str,
report_filter.detectionStatus))
AND.append(Report.detection_status.in_(dst))

if report_filter.reviewStatus:
if report_filter.reviewStatus and not report_filter.reportStatus:
OR = [Report.review_status.in_(
list(map(review_status_str, report_filter.reviewStatus)))]
AND.append(or_(*OR))
Expand Down
2 changes: 1 addition & 1 deletion web/server/vue-cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
},
"dependencies": {
"@mdi/font": "^6.5.95",
"codechecker-api": "file:../../api/js/codechecker-api-node/dist/codechecker-api-6.57.0.tgz",
"codechecker-api": "file:../../api/js/codechecker-api-node/dist/codechecker-api-6.58.0.tgz",
"chart.js": "^2.9.4",
"chartjs-plugin-datalabels": "^0.7.0",
"codemirror": "^5.65.0",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
<template>
<select-option
:id="id"
title="Report Status"
:bus="bus"
:fetch-items="fetchItems"
:loading="loading"
:selected-items="selectedItems"
:panel="panel"
@clear="clear(true)"
@input="setSelectedItems"
>
<template v-slot:icon="{ item }">
<review-status-icon :status="item.id" />
</template>

<template v-slot:append-toolbar-title>
<tooltip-help-icon>
Filter reports by the <b>latest</b> review status.<br><br>

Reports can be assigned a review status of the following values:
<ul>
<li>
<b>Unreviewed</b>: Nobody has seen this report.
</li>
<li>
<b>Confirmed:</b> This is really a bug.
</li>
<li>
<b>False positive:</b> This is not a bug.
</li>
<li>
<b>Intentional:</b> This report is a bug but we don't want to fix
it.
</li>
</ul>
</tooltip-help-icon>

<selected-toolbar-title-items
v-if="selectedItems"
:value="selectedItems"
/>
</template>
</select-option>
</template>

<script>
import { ccService, handleThriftError } from "@cc-api";
import { ReportFilter, ReviewStatus } from "@cc/report-server-types";
import TooltipHelpIcon from "@/components/TooltipHelpIcon";
import { ReviewStatusIcon } from "@/components/Icons";
import { ReviewStatusMixin } from "@/mixins";
import { SelectOption, SelectedToolbarTitleItems } from "./SelectOption";
import BaseSelectOptionFilterMixin from "./BaseSelectOptionFilter.mixin";
export default {
name: "ReportStatusFilter",
components: {
SelectOption,
ReviewStatusIcon,
SelectedToolbarTitleItems,
TooltipHelpIcon
},
mixins: [ BaseSelectOptionFilterMixin, ReviewStatusMixin ],
data() {
return {
id: "report-status"
};
},
methods: {
encodeValue(reviewStatusId) {
return this.reviewStatusFromCodeToString(reviewStatusId);
},
decodeValue(reviewStatusName) {
return this.reviewStatusFromStringToCode(reviewStatusName);
},
updateReportFilter() {
this.setReportFilter({
reportStatus: this.selectedItems.map(item => item.id)
});
},
onReportFilterChange(key) {
if (key === "reportStatus") return;
this.update();
},
fetchItems() {
this.loading = true;
console.log(this.reportFilter);
const reportFilter = new ReportFilter(this.reportFilter);
reportFilter.reviewStatus = null;
return new Promise(resolve => {
ccService.getClient().getReviewStatusCounts(this.runIds, reportFilter,
this.cmpData, handleThriftError(res => {
resolve(Object.keys(ReviewStatus).map(status => {
const id = ReviewStatus[status];
return {
id: id,
title: this.encodeValue(id),
count: res[id] !== undefined ? res[id].toNumber() : 0
};
}));
this.loading = false;
}));
});
}
}
};
</script>

Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@
<slot
name="menu-content"
:items="items"
:prevSelectedItems="prevSelectedItems"
:prev-selected-items="prevSelectedItems"
:apply="applyFilters"
:onApplyFinished="onApplyFinished"
:on-apply-finished="onApplyFinished"
:cancel="cancel"
:select="select"
>
Expand Down Expand Up @@ -84,7 +84,7 @@
</v-menu>
</template>

<slot :updateSelectedItems="updateSelectedItems">
<slot :update-selected-items="updateSelectedItems">
<items-selected
:selected-items="selectedItems"
:multiple="multiple"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import CheckerMessageFilter from "./CheckerMessageFilter";
import BaseFilterMixin from "./BaseFilter.mixin";
import BugPathLengthFilter from "./BugPathLengthFilter";
import TestcaseFilter from "./TestcaseFilter";
import ReportStatusFilter from "./ReportStatusFilter";

export {
AnalyzerNameFilter,
Expand All @@ -42,5 +43,6 @@ export {
CheckerMessageFilter,
BaseFilterMixin,
BugPathLengthFilter,
TestcaseFilter
TestcaseFilter,
ReportStatusFilter
};
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,18 @@
</v-list-item-content>
</v-list-item>

<v-divider />

<v-list-item class="pl-1">
<v-list-item-content class="pa-0">
<report-status-filter
ref="filters"
:namespace="namespace"
@update:url="updateUrl"
/>
</v-list-item-content>
</v-list-item>

<v-divider v-if="showReviewStatus" />

<v-list-item
Expand Down Expand Up @@ -332,6 +344,7 @@ import {
FilePathFilter,
FixDateFilter,
ReportHashFilter,
ReportStatusFilter,
ReviewStatusFilter,
SeverityFilter,
SourceComponentFilter,
Expand Down Expand Up @@ -368,7 +381,8 @@ export default {
CheckerMessageFilter,
RemoveFilteredReports,
BugPathLengthFilter,
TestcaseFilter
TestcaseFilter,
ReportStatusFilter
},
props: {
namespace: { type: String, required: true },
Expand Down

0 comments on commit 8c1b43b

Please sign in to comment.