DPDK patches and discussions
 help / color / mirror / Atom feed
From: Thomas Monjalon <thomas@monjalon.net>
To: Ferruh Yigit <ferruh.yigit@intel.com>
Cc: dev@dpdk.org
Subject: Re: [dpdk-dev] [PATCH] devtools: add cppcheck wrapper
Date: Thu, 20 May 2021 09:48:52 +0200	[thread overview]
Message-ID: <1872524.lENsVPqTGR@thomas> (raw)
In-Reply-To: <20210211172758.2977369-1-ferruh.yigit@intel.com>

11/02/2021 18:27, Ferruh Yigit:
> +CPPCHECK_BIN=cppcheck
> +out=cppcheck_error.txt

In general we generate files in $(mktemp -t dpdk.cppcheck.XXXXXX)
The path is printed at the end anyway.

> +
> +which ${CPPCHECK_BIN} > /dev/null 2> /dev/null
> +if [ $? -ne 0 ]; then
> +	echo "${CPPCHECK_BIN} is missing!"

Curly braces are not needed.

> +	exit 1
> +fi
> +
> +print_usage () {
> +	cat <<- END_OF_HELP
> +	usage: $(basename $0) [-h] [path]
> +
> +	Wrapper on checkpatch tool. Output goes to ${out} file.

s/checkpatch/cppcheck/

> +
> +	Without parameter current folder with all subfolders scanned. It is possible
> +	to provide a sub-folder to recude the scan to that folder.

A bit hard to read :)

> +	END_OF_HELP
> +}
> +
> +if [ "$1" = "-h" ]; then
> +	print_usage
> +	exit 1;
> +fi
> +
> +dir=${1:-$(dirname $(readlink -f $0))/..}
> +if [ ! -e ${dir} ]; then
> +	echo "\"${dir}\" is not valid folder/file to check"
> +	exit 1
> +fi
> +
> +
> +suppress_args="
> +	--suppress=invalidPrintfArgType_sint \
> +	--suppress=invalidPrintfArgType_uint \
> +	--suppress=duplicateAssignExpression \
> +	--suppress=nullPointerRedundantCheck \
> +	--suppress=identicalConditionAfterEarlyExit \
> +	--suppress=objectIndex
> +	"
> +
> +# all, warning, performance, portability,
> +# information, unusedFunction, missingInclude
> +additional_checks=warning
> +
> +${CPPCHECK_BIN} \
> +	-j64 \
> +	--language=c \
> +	--enable=${additional_checks} \
> +	--force \
> +	${suppress_args} \
> +	${dir} \
> +	2> ${out}

Is it possible to have only errors by default in the output,
and add all lines about what is being checked in a verbose mode?

> +
> +if [ $? -eq 0 ]; then
> +	echo -e "\nOutput saved to ${out}"

Please prefer printf.

> +else
> +	exit $?
> +fi

The report has 2000 lines of defects,
and it seems to have lots of false positive.
Is it possible to reduce them?



  reply	other threads:[~2021-05-20  7:48 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-11 17:27 Ferruh Yigit
2021-05-20  7:48 ` Thomas Monjalon [this message]
2023-06-12 23:55 ` Stephen Hemminger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1872524.lENsVPqTGR@thomas \
    --to=thomas@monjalon.net \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).