[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH 1/2] xen/cppcheck: sort alphabetically cppcheck report entries
On 09.01.2023 12:15, Michal Orzel wrote: > On 06/01/2023 11:41, Luca Fancellu wrote: >> 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. >> >> Signed-off-by: Luca Fancellu <luca.fancellu@xxxxxxx> >> --- >> xen/scripts/xen_analysis/cppcheck_report_utils.py | 2 ++ >> 1 file changed, 2 insertions(+) >> >> diff --git a/xen/scripts/xen_analysis/cppcheck_report_utils.py >> b/xen/scripts/xen_analysis/cppcheck_report_utils.py >> index 02440aefdfec..f02166ed9d19 100644 >> --- a/xen/scripts/xen_analysis/cppcheck_report_utils.py >> +++ b/xen/scripts/xen_analysis/cppcheck_report_utils.py >> @@ -104,6 +104,8 @@ 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 + "/", >> "") >> + # sort alphabetically the entries >> + text_report_content.sort() >> # Write the final text report >> outfile.writelines(text_report_content) >> except OSError as e: >> -- >> 2.17.1 >> >> > > Having the report sorted is certainly a good idea. I am just thinking whether > it should be done > per file or per finding (e.g. rule). When fixing MISRA issues, best approach > is to try to fix all > the issues for a given rule (i.e. a series fixing one rule) rather than all > the issues in a file > from different rules. Having a report sorted per finding would make this > process easier. We could > add a custom key to sort function to take the second element (after splitting > with ':' separator) > which is the name of the finding to achieve this goal. Let me know your > thoughts. +1 - sorting by file name wants to be the 2nd sorting criteria, i.e. only among all instances of the same finding. Jan
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |