[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [xen master] xen/cppcheck: sort alphabetically cppcheck report entries
commit 94f154f1681a54a1e1d1226bd6a6ecd216f9eddc Author: Luca Fancellu <luca.fancellu@xxxxxxx> AuthorDate: Mon Jan 30 11:01:31 2023 +0000 Commit: Stefano Stabellini <stefano.stabellini@xxxxxxx> CommitDate: Thu Feb 2 12:02:43 2023 -0800 xen/cppcheck: sort alphabetically cppcheck report entries Sort alphabetically cppcheck report entries when producing the text report, this will help comparing different reports and will group together findings from the same file. The sort operation is performed with two criteria, the first one is sorting by misra rule, the second one is sorting by file. Signed-off-by: Luca Fancellu <luca.fancellu@xxxxxxx> [stefano: add black line for code style] Signed-off-by: Stefano Stabellini <stefano.stabellini@xxxxxxx> Reviewed-by: Michal Orzel <michal.orzel@xxxxxxx> Acked-by: Stefano Stabellini <sstabellini@xxxxxxxxxx> --- xen/scripts/xen_analysis/cppcheck_report_utils.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/xen/scripts/xen_analysis/cppcheck_report_utils.py b/xen/scripts/xen_analysis/cppcheck_report_utils.py index 02440aefdf..c5f466aff1 100644 --- a/xen/scripts/xen_analysis/cppcheck_report_utils.py +++ b/xen/scripts/xen_analysis/cppcheck_report_utils.py @@ -104,6 +104,14 @@ def cppcheck_merge_txt_fragments(fragments_list, out_txt_file, strip_paths): for path in strip_paths: text_report_content[i] = text_report_content[i].replace( path + "/", "") + # Split by : separator + text_report_content[i] = text_report_content[i].split(":") + + # sort alphabetically for second field (misra rule) and as second + # criteria for the first field (file name) + text_report_content.sort(key = lambda x: (x[1], x[0])) + # merge back with : separator + text_report_content = [":".join(x) for x in text_report_content] #Â Write the final text report outfile.writelines(text_report_content) except OSError as e: -- generated by git-patchbot for /home/xen/git/xen.git#master
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |