fix cmdline client result query (json)
Only the query limit number of results were printed
if json output format was selected.
@@ -289,21 +289,26 @@ def handle_list_results(args):
add_filter_conditions(report_filter, args.filter)
filters.append(report_filter)
+ all_results = []
results = client.getRunResults(run_id, limit, offset, None, filters)
+ while results:
+ all_results.extend(results)
+ offset += limit
+ results = client.getRunResults(run_id, limit, offset, None,
+ filters)
+
if args.output_format == 'json':
- print(CmdLineOutputEncoder().encode(results))
- else: # plaintext, csv
+ print(CmdLineOutputEncoder().encode(all_results))
+ else:
rows = []
-
if args.suppressed:
rows.append(
('File', 'Checker', 'Severity', 'Msg', 'Suppress comment'))
else:
rows.append(('File', 'Checker', 'Severity', 'Msg'))
- while results:
- for res in results:
+ for res in all_results:
bug_line = res.lastBugPosition.startLine
checked_file = res.checkedFile + ' @ ' + str(bug_line)
sev = shared.ttypes.Severity._VALUES_TO_NAMES[res.severity]
@@ -315,10 +320,6 @@ def handle_list_results(args):
rows.append(
(checked_file, res.checkerId, sev, res.checkerMsg))
- offset += limit
- results = client.getRunResults(run_id, limit, offset, None,
- filters)
-
if args.output_format == 'csv':
writer = csv.writer(sys.stdout)
writer.writerows(rows)
@@ -396,27 +397,34 @@ def handle_diff_results(args):
report_filter = [
codeCheckerDBAccess.ttypes.ReportFilter(suppressed=suppr)]
add_filter_conditions(report_filter[0], args.filter)
- rows, sort_type, limit, offset = [], None, 500, 0
- rows.append(('File', 'Checker', 'Severity', 'Msg'))
+ sort_type = None
+ limit = 500
+ offset = 0
+
+ all_results=[]
results = getterFn(baseid, newid, limit, offset, sort_type,
report_filter)
- if output_format == 'json':
- print(CmdLineOutputEncoder().encode(results))
- else: # plaintext, csv
while results:
- for res in results:
+ all_results.extend(results)
+ offset += limit
+ results = getterFn(baseid, newid, limit, offset, sort_type,
+ report_filter)
+
+
+ if output_format == 'json':
+ print(CmdLineOutputEncoder().encode(all_results))
+ else:
+ rows = []
+ rows.append(('File', 'Checker', 'Severity', 'Msg'))
+ for res in all_results:
bug_line = res.lastBugPosition.startLine
sev = shared.ttypes.Severity._VALUES_TO_NAMES[res.severity]
checked_file = res.checkedFile + ' @ ' + str(bug_line)
rows.append(
(checked_file, res.checkerId, sev, res.checkerMsg))
- offset += limit
- results = getterFn(baseid, newid, limit, offset, sort_type,
- report_filter)
-
if output_format == 'csv':
writer = csv.writer(sys.stdout)
writer.writerows(rows)
