Skip to content

Commit

Permalink
[feature] 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 28, 2024
2 parents 73982bf + 837fdf2 commit 36722b4
Show file tree
Hide file tree
Showing 8 changed files with 102 additions and 63 deletions.
Binary file modified web/api/py/codechecker_api/dist/codechecker_api.tar.gz
Binary file not shown.
Binary file not shown.
65 changes: 31 additions & 34 deletions web/server/codechecker_server/api/report_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
SourceComponent

from .thrift_enum_helper import detection_status_enum, \
detection_status_str, report_status_enum, report_status_str, \
detection_status_str, report_status_enum, \
review_status_enum, review_status_str, report_extended_data_type_enum


Expand Down Expand Up @@ -302,31 +302,33 @@ def process_report_filter(
AND.append(or_(*OR))

if report_filter.reportStatus:
print("itt")
# 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 ReportStatus.OUTSTANDING in report_filter.reportStatus:
AND.append(and_(Report.review_status.in_(rst), Report.detection_status.in_(dst)))

(API_ReviewStatus.UNREVIEWED,
API_ReviewStatus.CONFIRMED)))

OR = []
filter_query = and_(
Report.review_status.in_(rst),
Report.detection_status.in_(dst)
)
if ReportStatus.OUTSTANDING in report_filter.reportStatus:
OR.append(filter_query)

if ReportStatus.CLOSED in report_filter.reportStatus:
AND.append(not_(and_(Report.review_status.in_(rst), Report.detection_status.in_(dst))))
print("teszt")
print(*AND)
OR.append(not_(filter_query))

if report_filter.detectionStatus and not report_filter.reportStatus:
AND.append(or_(*OR))

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

if report_filter.reviewStatus and not report_filter.reportStatus:
if report_filter.reviewStatus:
OR = [Report.review_status.in_(
list(map(review_status_str, report_filter.reviewStatus)))]
AND.append(or_(*OR))
Expand Down Expand Up @@ -1887,9 +1889,6 @@ def getDiffResultsHash(self, run_ids, report_hashes, diff_type,
@timeit
def getRunResults(self, run_ids, limit, offset, sort_types,
report_filter, cmp_data, get_details):
if report_filter.detectionStatus:
print("report_filter")
print(report_filter.detectionStatus)
self.__require_view()

limit = verify_limit_range(limit)
Expand Down Expand Up @@ -3300,39 +3299,37 @@ def getReportStatusCounts(self, run_ids, report_filter, cmp_data):
if report_filter.annotations is not None:
extended_table = extended_table.outerjoin(
ReportAnnotations,
ReportAnnotations.report_id == Report.id)
ReportAnnotations.report_id == Report.id
)
extended_table = extended_table.group_by(Report.id)

extended_table = apply_report_filter(
extended_table, filter_expression, join_tables)

extended_table = extended_table.subquery()

is_opened_case = get_is_opened_case(extended_table)

is_outstanding_case = get_is_opened_case(extended_table)
case_label = "isOutstanding"

if report_filter.isUnique:
q = session.query(
is_opened_case.label("isOpened"),
is_outstanding_case.label(case_label),
func.count(extended_table.c.bug_id.distinct())) \
.group_by(is_opened_case)
.group_by(is_outstanding_case)
else:
q = session.query(
is_opened_case.label("isOpened"),
is_outstanding_case.label(case_label),
func.count(extended_table.c.bug_id)) \
.group_by(is_opened_case)
.group_by(is_outstanding_case)

# return {ReportStatus.OUTSTANDING if isOutstanding
# else ReportStatus.CLOSED: count
# for isOutstanding, count in q}
results = {
report_status_enum("outstanding" if isOutstanding
else "closed"): count
for isOutstanding, count in q}
print("results")
print(results)
return results
report_status_enum(
"outstanding" if isOutstanding
else "closed"
): count for isOutstanding, count in q
}

return results

@exc_to_thrift_reqfail
@timeit
Expand Down
4 changes: 3 additions & 1 deletion web/server/codechecker_server/api/thrift_enum_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ def report_extended_data_type_enum(status):
elif status == 'fixit':
return ExtendedReportDataType.FIXIT


def report_status_str(status):
"""
Returns the given report status Thrift enum value.
Expand All @@ -129,11 +130,12 @@ def report_status_str(status):
elif status == ReportStatus.CLOSED:
return 'closed'


def report_status_enum(status):
"""
Converts the given report status to string.
"""
if status == 'outstanding':
return ReportStatus.OUTSTANDING
elif status == 'closed':
return ReportStatus.CLOSED
return ReportStatus.CLOSED
4 changes: 2 additions & 2 deletions web/server/vue-cli/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -16,24 +16,42 @@

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

Reports can be assigned a review status of the following values:
A report can be outstanding or closed.
Outstanding reports are potential bugs.
Closed reports are fixed bugs, suppressed, resolved
or unavailable reports.

<br><br>

The report is <b>outstanding</b> when its
<ul>
<li>
<b>Unreviewed</b>: Nobody has seen this report.
<b>Review status</b>: is unreviewed or confirmed
</li>
<b>and</b>
<li>
<b>Confirmed:</b> This is really a bug.
<b>Detection status</b>: is new, unresolved or reopened.
</li>
</ul>
The report is <b>closed</b> when its
<ul>
<li>
<b>False positive:</b> This is not a bug.
<b>Review status</b>: is false positive, intentional
</li>
<b>or</b>
<li>
<b>Intentional:</b> This report is a bug but we don't want to fix
it.
<b>Detection status</b>: is resolved, off or unavailable.
</li>
</ul>

<br>

<b>
When the report status filter is set, modification of
the review and the detection status filter is not prevalent.
</b>
</tooltip-help-icon>

<selected-toolbar-title-items
Expand Down Expand Up @@ -95,7 +113,6 @@ export default {
this.loading = true;
const reportFilter = new ReportFilter(this.reportFilter);
reportFilter.reportStatus = null;
return new Promise(resolve => {
ccService.getClient().getReportStatusCounts(this.runIds, reportFilter,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,18 @@
</template>

<template #item.closed="{ item }">
<span>
<span v-if="item.closed">
<router-link
:to="{ name: 'reports', query: {
...uniqueMode,
...getBaseQueryParams(item),
'report-status': reportStatusFromCodeToString(ReportStatus.CLOSED)
}}"
>
{{ item.closed }}
</router-link>
</span>
<span v-else>
{{ item.closed }}
</span>
</template>
Expand All @@ -305,17 +316,11 @@
<span v-if="item.outstanding">
<router-link
:to="{ name: 'reports', query: {
...$router.currentRoute.query,
...uniqueMode,
...getBaseQueryParams(item),
'review-status': [
reviewStatusFromCodeToString(ReviewStatus.UNREVIEWED),
reviewStatusFromCodeToString(ReviewStatus.CONFIRMED)
],
'detection-status': [
detectionStatusFromCodeToString(DetectionStatus.NEW),
detectionStatusFromCodeToString(DetectionStatus.REOPENED),
detectionStatusFromCodeToString(DetectionStatus.UNRESOLVED)
]
'report-status': reportStatusFromCodeToString(
ReportStatus.OUTSTANDING
)
}}"
>
{{ item.outstanding }}
Expand Down Expand Up @@ -351,14 +356,19 @@
</template>

<script>
import { DetectionStatus, ReviewStatus } from "@cc/report-server-types";
import {
DetectionStatus,
ReportStatus,
ReviewStatus
} from "@cc/report-server-types";
import {
DetectionStatusIcon,
ReviewStatusIcon,
SeverityIcon
} from "@/components/Icons";
import {
DetectionStatusMixin,
ReportStatusMixin,
ReviewStatusMixin,
SeverityMixin
} from "@/mixins";
Expand All @@ -376,7 +386,12 @@ export default {
SeverityIcon,
SourceComponentTooltip
},
mixins: [ DetectionStatusMixin, ReviewStatusMixin, SeverityMixin ],
mixins: [
DetectionStatusMixin,
ReportStatusMixin,
ReviewStatusMixin,
SeverityMixin
],
props: {
items: { type: Array, required: true },
colspan: { type: Number, default: 2 },
Expand All @@ -389,8 +404,9 @@ export default {
},
data() {
return {
ReviewStatus,
DetectionStatus
DetectionStatus,
ReportStatus,
ReviewStatus
};
},
computed: {
Expand All @@ -404,6 +420,15 @@ export default {
this.totalColumns.forEach(c => total[c] += curr[c].count);
return total;
}, initVal);
},
uniqueMode() {
if ( this.$router.currentRoute.query["is-unique"] !== undefined ) {
return {
"is-unique": this.$router.currentRoute.query["is-unique"]
};
}
else return {};
}
},
methods: {
Expand Down
4 changes: 1 addition & 3 deletions web/server/vue-cli/src/views/Reports.vue
Original file line number Diff line number Diff line change
Expand Up @@ -490,9 +490,7 @@ export default {
const offset = limit * (this.pagination.page - 1);
const sortType = this.getSortMode();
const getDetails = false;
this.reportFilter.detectionStatus = [ 1 ];
console.log(this.reportFilter.reportStatus);
console.log(this.reportFilter.detectionStatus);
ccService.getClient().getRunResults(this.runIds, limit, offset, sortType,
this.reportFilter, this.cmpData, getDetails,
handleThriftError(reports => {
Expand Down

0 comments on commit 36722b4

Please sign in to comment.