4 ## Copyright (c) 2010-2017 Intel Corporation
6 ## Licensed under the Apache License, Version 2.0 (the "License");
7 ## you may not use this file except in compliance with the License.
8 ## You may obtain a copy of the License at
10 ## http://www.apache.org/licenses/LICENSE-2.0
12 ## Unless required by applicable law or agreed to in writing, software
13 ## distributed under the License is distributed on an "AS IS" BASIS,
14 ## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 ## See the License for the specific language governing permissions and
16 ## limitations under the License.
19 bad_lines=$(grep -nHr -e "[[:space:]]$" *.c *.h gen/*.cfg config/*.cfg)
21 if [ -n "$bad_lines" ]; then
22 echo "Found trailing white-spaces:"
27 for f in *.c *.h gen/*.cfg config/*.cfg; do
28 result=$(tail -n 1 $f | grep "^$" | wc -l)
30 if [ "$result" == "1" ]; then
31 echo "Trailing newlines at end of file $f"
37 function findDuplicate() {
40 if [ "$prev" == "" ]; then
41 if [ "$p" == "" ]; then
42 echo "duplicate empty line at $1:$line"
56 if [ "$bad" != "0" ]; then
61 bad_lines=$(grep -nHr -e "^$tab$tab$tab$tab$tab$tab$tab" *.c *.h | head -n1)
63 if [ -n "$bad_lines" ]; then
64 echo "Code nested too deep:"