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

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


  • To: Michal Orzel <michal.orzel@xxxxxxx>
  • From: Luca Fancellu <Luca.Fancellu@xxxxxxx>
  • Date: Mon, 30 Jan 2023 11:26:18 +0000
  • Accept-language: en-GB, en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.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=wr28CWpgDAy8PG03ixLv5XhCoOG/I/wArDIjzVqZcSw=; b=EPSf+HOLhQeRmRkCd+o390N70Vv6KqtQcszP8E6hTRepEXJXr+7mxTWZP6zw0pBuCKgGty5a5Gd1xSQGV/2sdKgBG7DJcyK6gmGhp+dYjK6jn9jBryjnYW+jQP6hfxuQYr0OgZJp4HYB8qHy/hB8cI3znrevBMAZeeQ62EBpkLTUEN94Ub8FouUrYRwoWOzvG99bp5PAtWbGdriFKqQfPAL5smBzlukgV2tjmaP0to2p+ow5jj8GZykj7V7JHo21Q2OBVO8LWP2yreek0IzY6OTExcvQSptZXuC1YgX5ex7oZLTR8NaaoI8vd6H54upawtQ26XYgyBb2A7FiWlBXqg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VicdB19/MTrqkxo2D7QnalozPrv+vLHrmfy5fbdcRv/CJnj+GC/h14pJxXJgoxCpEKQZU7qMYrVA8BfK2mensqU60HDs5G756yqI1BEqDSbuKOnQz7/dkvj6az9/tqZC+pCJgsnzrAGeOlalOONcM2CFI9KMoWBbeoQeP9Zxp9RWfUcIvf/C8dLVd87SIafiBr7wnmdKYxJHrAShP8CMRW2bTZQc0u8RIV6wWQd3I0SPH8bwNgcmYg1zcmNpWrL2FkWIv/qNcNuTz0OzQufBi/Fl6wwRtWy1w3B7wxMspLQOC92d/8g93apA2qc2x3NezZzECLO/fLwAd6CcfHm7jg==
  • Authentication-results-original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Cc: Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Bertrand Marquis <Bertrand.Marquis@xxxxxxx>, Wei Chen <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, 30 Jan 2023 11:26:47 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Nodisclaimer: true
  • Original-authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Thread-index: AQHZNJpUJ5ClhO3EhEi0PsL49bNu7q620S8AgAAA5oA=
  • Thread-topic: [PATCH v2 1/2] xen/cppcheck: sort alphabetically cppcheck report entries


> On 30 Jan 2023, at 11:22, Michal Orzel <michal.orzel@xxxxxxx> wrote:
> 
> Hi Luca,
> 
> On 30/01/2023 12:01, 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.
>> 
>> 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>
>> ---
>> Changes in v2:
>> - Sort with two criteria, first misra rule, second filename
>>   (Michal, Jan)
>> ---
>> ---
>> xen/scripts/xen_analysis/cppcheck_report_utils.py | 7 +++++++
>> 1 file changed, 7 insertions(+)
>> 
>> diff --git a/xen/scripts/xen_analysis/cppcheck_report_utils.py 
>> b/xen/scripts/xen_analysis/cppcheck_report_utils.py
>> index 02440aefdfec..0b6cc72b9ac1 100644
>> --- a/xen/scripts/xen_analysis/cppcheck_report_utils.py
>> +++ b/xen/scripts/xen_analysis/cppcheck_report_utils.py
>> @@ -104,6 +104,13 @@ 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(":")
> This is where the for loop body ends so it should be separated from the rest 
> by an empty line.
> 
>> +            # sort alphabetically for second field (misra rule) and as 
>> second
> The second field is not necessary a "misra rule". It is just an error id 
> (e.g. unreadVariable).
> However this is just a python script and we use cppcheck mostly for MISRA so 
> I do not object.

Yes you are right, if the committer is willing to change it on commit I’ll 
appreciate, otherwise I can
fix it and respin the patch.

> 
>> +            # 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:
>> --
>> 2.25.1
>> 
> 
> With the first remark fixed (e.g. on commit),
> Reviewed-by: Michal Orzel <michal.orzel@xxxxxxx>

Thank you for your review

> 
> ~Michal



 


Rackspace

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