Files
libmetal/scripts/do_checkpatch.sh
Arnaud Pouliquen 2de2e14bda scripts: add checkpatch tool
Initial version of checkpatch tool cloned from zephyr project.

Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@st.com>

Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@st.com>
2020-04-08 17:07:02 +02:00

30 lines
941 B
Bash
Executable File

#!/bin/sh
#
# Copyright (c) 2019 STMicroelectronics .
# Copyright (c) 2015 Intel Corporation.
#
# SPDX-License-Identifier: Apache-2.0
#
res=$1
[ -z "$res" ] && res="checkpatch_log"
[ -f ${res} ] && rm ${res}
[ -f ${res}_error.types ] && rm ${res}_error.types
[ -f ${res}_warning.types ] && rm ${res}_warning.types
dirs_to_check="lib"
files=$(for d in ${dirs_to_check}; do find $d/ -type f -name '*.[ch]'; done)
for i in $files; do
./scripts/checkpatch.pl --no-tree -f --emacs --summary-file --show-types --ignore BRACES,PRINTK_WITHOUT_KERN_LEVEL,SPLIT_STRING,PREFER_KERNEL_TYPES,NEW_TYPEDEFS --max-line-length=90 $i >> ${res}
done
grep ERROR: ${res} |cut -d : -f 3,4 |sort -u > ${res}_error.types
grep WARNING: ${res} |cut -d : -f 3,4 |sort -u > ${res}_warning.types
for i in `cat ${res}_error.types`; do
echo -n $i ' '; grep $i ${res} | wc -l
done
for i in `cat ${res}_warning.types`; do
echo -n $i ' '; grep $i ${res} | wc -l
done