blob: 29d14bdb4a911ed1bd2973185c2d266aac8a9869 [file] [log] [blame]
Anthony Barbier6ff3b192017-09-04 18:44:23 +01001#!/bin/bash
2
3set -e
4
5DIRECTORIES="./arm_compute ./src ./examples ./tests ./utils"
6
7grep -HrnP "/\*\*$" $DIRECTORIES | tee bad_style.log
8if (( `cat bad_style.log | wc -l` > 0 ))
9then
10 echo ""
11 echo "ERROR: Doxygen comments should start on the first line: \"/** My comment\""
12 exit -1
13fi
14
15grep -Hnr --exclude=Doxyfile "@brief" $DIRECTORIES | tee bad_style.log
16if (( `cat bad_style.log | wc -l` > 0 ))
17then
18 echo ""
19 echo "ERROR: Doxygen comments shouldn't use '@brief'"
20 exit -1
21fi
22
23grep -HnRE "\buint " --exclude-dir=cl_kernels $DIRECTORIES | tee bad_style.log
24if [[ $(cat bad_style.log | wc -l) > 0 ]]
25then
26 echo ""
27 echo "ERROR: C/C++ don't define 'uint'. Use 'unsigned int' instead."
28 exit -1
29fi
30
31grep -HnR "float32_t" $DIRECTORIES | tee bad_style.log
32if [[ $(cat bad_style.log | wc -l) > 0 ]]
33then
34 echo ""
35 echo "ERROR: C/C++ don't define 'float32_t'. Use 'float' instead."
36 exit -1
37fi
38
39grep -Hnir "arm[_ ]\?cv" $DIRECTORIES | tee bad_style.log
40if [[ $(cat bad_style.log | wc -l) > 0 ]]
41then
42 echo ""
43 echo "ERROR: Reference to arm_cv detected in the files above (Replace with arm_compute)"
44 exit -1
45fi
46
Anthony Barbierac69aa12017-07-03 17:39:37 +010047grep -Hnir "#.*defined[^(]" $DIRECTORIES | tee bad_style.log
48if [[ $(cat bad_style.log | wc -l) > 0 ]]
49then
50 echo ""
51 echo "ERROR: use parenthesis after #if defined(MY_PREPROCESSOR)"
52 exit -1
53fi
54
55grep -Hnir "#else$\|#endif$" $DIRECTORIES | tee bad_style.log
56if [[ $(cat bad_style.log | wc -l) > 0 ]]
57then
58 echo ""
59 echo "ERROR: #else and #endif should be followed by a comment of the guard they refer to (e.g /* ARM_COMPUTE_ENABLE_FP16 */ )"
60 exit -1
61fi
62
63
Anthony Barbier6ff3b192017-09-04 18:44:23 +010064spdx_missing=0
65for f in $(find $DIRECTORIES -type f)
66do
67 if [[ $(grep SPDX $f | wc -l) == 0 ]]
68 then
69 # List of exceptions:
70 case `basename $f` in
71 "arm_compute_version.embed");;
72 ".clang-format");;
73 ".clang-tidy");;
74 #It's an error for other files to not contain the MIT header:
75 *)
76 spdx_missing=1
77 echo $f;
78 ;;
79 esac
80 fi;
81done
82
83if [[ $spdx_missing > 0 ]]
84then
85 echo ""
86 echo "ERROR: MIT Copyright header missing from the file(s) above."
87 exit -1
88fi