|
[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
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
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |