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

Re: [PATCH 1/2] xen/cppcheck: add a way to exclude files from the scan


  • To: Luca Fancellu <luca.fancellu@xxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Tue, 14 Feb 2023 10:51:35 +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=AZocWXyZtw3yVPEYBp1SF2PtD/fD8PSpNe7v3NRbbHM=; b=RXt85asNcjIuwysUjGxYtfgYo1wGm+gHeRW6HE6deInq0ol++rklwYQU0WqB0GdmqiRVfQYa4IVbHmW4/yquWySrfwBHOjZvzwgoSFQgXAac97/6upEKzq/bCbNX9RyJndBcgQWuxPcw5GJSr+FhGAD0vobmoaSOoPmHK81HKoBkvmwf6dZyndDtek6VVpcKVr/j0pV3UIRQ4ZUMbB1EOQ2qgpleyoM/ecnM88uTfD+KFw0VxVh5V6e9Ngzii3+5l/rvmmzv1++dd3Ly8Ta/ewRvMUIW+5KAMrW0ZMcbP4zTffcSXmKqkBXkPLHJW8CBEdhIWsgjSjMtY1V63Fz57w==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HKPgDmxr3JcwFy2oMwj1JOMtn3GayE2zJrurM61g4yBQHPHGjsgPc7N5WWDc6saCpY4eOhr/waAiiu3CwBpUQQgSzqg6uwbddhIp0s2YLsgDTe0s4FyVDKGbGIB9hEtMN00FnKMPHwFxkOGM4kea80KOhFP4UBHXcfyEH5I5NFcc2FCEGRftsjA3iMjvTwTNKnmji9v8PQW1NGl6qIBbh1EBxflxJ88j4apU7qWfpAl+yjzQOuq3HaV9FvYt05Aa3MELcs1gadpOjbPQZpKpyO2Zx1ILWXAXN2TmmZ/gyL44oEKX3721OFbJv3a4zbAPQXNx1SfTCcAMdEaloWHAyg==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: wei.chen@xxxxxxx, bertrand.marquis@xxxxxxx, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, Wei Liu <wl@xxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Tue, 14 Feb 2023 09:52:45 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 14.02.2023 09:56, Luca Fancellu wrote:
> Add a way to exclude files from the scan, in this way we can skip
> some findings from the report on those files that Xen doesn't own.
> 
> To do that, introduce the exclude-list.json file under docs/misra,
> this file will be populated with relative path to the files/folder
> to be excluded.
> Introduce a new module, exclusion_file_list.py, to deal with the
> exclusion list file and use the new module in cppcheck_analysis.py
> to take a list of excluded paths to update the suppression list of
> cppcheck.
> Modified --suppress flag for cppcheck tool to remove
> unmatchedSuppression findings for those external file that are
> listed but for example not built for the current architecture.
> 
> Add documentation for the file.
> 
> Signed-off-by: Luca Fancellu <luca.fancellu@xxxxxxx>
> ---
>  docs/misra/exclude-list.json                  |  4 +
>  docs/misra/exclude-list.rst                   | 44 +++++++++++
>  xen/scripts/xen_analysis/cppcheck_analysis.py | 21 ++++-
>  .../xen_analysis/exclusion_file_list.py       | 79 +++++++++++++++++++
>  4 files changed, 146 insertions(+), 2 deletions(-)
>  create mode 100644 docs/misra/exclude-list.json
>  create mode 100644 docs/misra/exclude-list.rst
>  create mode 100644 xen/scripts/xen_analysis/exclusion_file_list.py

As I think I have asked for before: Can new files please avoid underscores
in their names, when dashes do quite fine? Or does Python have special
restrictions?

> --- a/xen/scripts/xen_analysis/cppcheck_analysis.py
> +++ b/xen/scripts/xen_analysis/cppcheck_analysis.py
> @@ -1,7 +1,8 @@
>  #!/usr/bin/env python3
>  
>  import os, re, shutil
> -from . import settings, utils, cppcheck_report_utils
> +from . import settings, utils, cppcheck_report_utils, exclusion_file_list
> +from .exclusion_file_list import ExclusionFileListError
>  
>  class GetMakeVarsPhaseError(Exception):
>      pass
> @@ -50,6 +51,22 @@ def __generate_suppression_list(out_file):
>              # header for cppcheck
>              supplist_file.write("*:*generated/compiler-def.h\n")
>  
> +            try:
> +                exclusion_file = \
> +                    
> "{}/docs/misra/exclude-list.json".format(settings.repo_dir)
> +                exclusion_list = \
> +                    
> exclusion_file_list.load_exclusion_file_list(exclusion_file)
> +            except ExclusionFileListError as e:
> +                    raise CppcheckDepsPhaseError(
> +                            "Issue with reading file {}: {}"
> +                                .format(exclusion_file, e)
> +                          )

My Python isn't very good, but isn't indentation one level too deep
here?

Jan



 


Rackspace

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