1#!/bin/sh
2
3#
4# Copyright (c) 2015 Intel Corporation.
5#
6# SPDX-License-Identifier: Apache-2.0
7#
8
9[ -f $1 ] && rm $1
10[ -f $1_error.types ] && rm $1_error.types
11[ -f $1_warning.types ] && rm $1_warning.types
12
13dirs_to_check="arch drivers include kernel lib"
14files=$(for d in ${dirs_to_check}; do find $d/ -type f -name '*.[ch]'; done)
15for i in $files; do
16	${ZEPHYR_BASE}/scripts/checkpatch.pl --mailback --no-tree -f --emacs --summary-file --show-types --ignore BRACES,PRINTK_WITHOUT_KERN_LEVEL,SPLIT_STRING --max-line-length=100 $i >> $1
17done
18grep ERROR: $1 |cut -d : -f 3,4 |sort -u > $1_error.types
19grep WARNING: $1 |cut -d : -f 3,4 |sort -u > $1_warning.types
20for i in `cat $1_error.types`; do
21	echo -n $i ' '; grep $i $1 | wc -l
22done
23for i in `cat $1_warning.types`; do
24	echo -n $i ' '; grep $i $1 | wc -l
25done
26