scripts: add checkpatch tool

Initial version of checkpatch tool cloned from zephyr project.

Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@st.com>
This commit is contained in:
Arnaud Pouliquen
2020-01-06 17:54:16 +01:00
parent 2af66b5358
commit c7678f5adc
4 changed files with 7733 additions and 0 deletions

22
.checkpatch.conf Normal file
View File

@@ -0,0 +1,22 @@
--emacs
--no-tree
--summary-file
--show-types
--max-line-length=80
--min-conf-desc-length=1
--ignore BRACES
--ignore PRINTK_WITHOUT_KERN_LEVEL
--ignore SPLIT_STRING
--ignore VOLATILE
--ignore CONFIG_EXPERIMENTAL
--ignore AVOID_EXTERNS
--ignore NETWORKING_BLOCK_COMMENT_STYLE
--ignore DATE_TIME
--ignore MINMAX
--ignore CONST_STRUCT
--ignore FILE_PATH_CHANGES
--ignore BIT_MACRO
--ignore PREFER_KERNEL_TYPES
--ignore NEW_TYPEDEFS
--ignore ARRAY_SIZE

6494
scripts/checkpatch.pl Executable file

File diff suppressed because it is too large Load Diff

29
scripts/do_checkpatch.sh Executable file
View File

@@ -0,0 +1,29 @@
#!/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

1188
scripts/spelling.txt Normal file

File diff suppressed because it is too large Load Diff