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

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


  • To: Michal Orzel <michal.orzel@xxxxxxx>, Luca Fancellu <luca.fancellu@xxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Mon, 9 Jan 2023 12:41:46 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; 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=60wc/vwFvoq+aOfiArChDicj2kOicqX9zYbvV3rdDSQ=; b=Ws1F3wXP2F5oHCYRWD76Xn05vww4AO6TsE9scpoY/9LIqI0dvXiwKV/LJIm9GX4IQnwNsudSOx+iLg2PdJNGuGlreqxZ6v0zP6xIqECN/WcytVsCjQf6CPfHDHpnczfncvDRkWklbtdESXRN2ZxJppIyqZVJp/tndsreblVi4Zbepxs2Tg27yaqsnXsOMKI3MbI5br4xo30Lg/hHPnGo/COFAArbGmveKUSCDsYMO5JF54fl+vvNMRF9mKYkFEqY3Um87WvzROOQX76DQ6Nq9eeO6gZBk4OtQG++8qHeEk3xPED3+l1jnTsiiD0O5rBk8edbaZfG9uRjoHwbzwgl5w==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dPaYxXm471tiT+NlC/PqDcVZ4B/n9IoQmquFif2yYGhkcEqxT8JEdlQjxG695tpsfp1BwxpKTd/9sT/1UliBX01SBAHKXn5s/NF6zuOBFcRd0/wRNHtZRHQLccXBzf9e9CP7TF2QUPUdPzRl6ONdi/H7mx8zDKVIW09xJpKa8A9DnFJASaoShQDfdqt6QJM/+Q/kvKsvhVkM/5IiZ0Ne5avQYWDnE3v0SvKwAduMqzhAOpsurlZygszHDVCE4cW/t0qA4cH++nO/M0hxKaY+eke97kEQDVd7qqZfbcFY3W0m1FjFhX5wX+4HdI5/o/uCV9nIIUWIqtMk6F/3Dx3X9A==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: wei.chen@xxxxxxx, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx, George Dunlap <george.dunlap@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>
  • Delivery-date: Mon, 09 Jan 2023 11:41:53 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

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



 


Rackspace

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