[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 1/2] xen/cppcheck: sort alphabetically cppcheck report entries


  • To: Luca Fancellu <luca.fancellu@xxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Michal Orzel <michal.orzel@xxxxxxx>
  • Date: Mon, 9 Jan 2023 12:15:02 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=arm.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=SxPfohhAy9Pfz20exhjw8wrurETc87GXeKs0KT+jF6s=; b=PovTWRX9ik1Ysh+NbGNPglzQhIaH+u8k+vRQhw6GMidSebVDWY8PrD81TZ3V5HAChTqsI3/ojp6NJ3w6HXbw8rqKiS7sjilQ0SRIFdtoa7cVUoGwAn9TlJrYsFmayu4xnc5A9NiVdfG1HUecAHXS2aIXX1nJVYIZ6me3UyjJVmY1V1GpwRWFGHwUxidp22sGKy6pwCCBNaBISTGZhGcDKlCJXE/Mgmh0BdasrITWnh71cHbodes3RgIv+Nt/6tuEq1S6GgQR+pnHE2+ccQ/3rtNzcAn6bL2yMAfwVvx6ji7O/Ip2cnrkg6C+CL/WyL5LHznfggtXvIxpMmAlvtMNVA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=K1/+2q7QWZHrBzeI83U4dvkmjyRXXPMNuyccV+cP+S9qq5zXz9s8TolbEL9HHpYcBeFQwAFOGJJJ9rwBwRllSkTvrDp9CsFgoz8RIePboDZyn5yPyU+b6OlL6xwJzBREVVKhPB9tta/o5SOueEsgLRTT8LG3VfNWhzTSOdG5ByRorSqJIp3c74mQZcG5nP7wWcHWpiJdkzygbnbHD4TClFLr0aJEIRBqceMUOjoWrFRQVJdMohuE3cZUHN4tsGgPk92G0o7B7BAJX27zOMKhCHgWQIeoOm0V9/N9A21IHk4799rkG+GfnpNDpJZVHKa2rdRA1JTblmDSA/qgSWJ8gA==
  • Cc: <wei.chen@xxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, "George Dunlap" <george.dunlap@xxxxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, "Julien Grall" <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>
  • Delivery-date: Mon, 09 Jan 2023 11:15:21 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

Hi Luca,

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.

~Michal



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.