forked from makman07/curve
-
Notifications
You must be signed in to change notification settings - Fork 0
/
check.sh
executable file
·50 lines (41 loc) · 1.04 KB
/
check.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/usr/bin/env bash
# Copyright (C) 2023 Jingli Chen (Wine93), NetEase Inc.
############################ GLOBAL VARIABLES
g_type="$1"
############################ FUNCTIONS
precheck() {
if [ -z "$(which xq)" ]; then
die "xq not found, please install it.\n"
fi
if [ -z "$(which cpplint)" ]; then
die "cpplint not found, please install it.\n"
fi
if [[ ${g_type} != "bs" && ${g_type} != "fs" ]]; then
die "please specify storage type: bs or fs\n"
fi
}
get_files() {
if [ "$g_type" = "bs" ]; then
find src test -name '*.h' -or -name '*.cpp'
elif [ "$g_type" = "fs" ]; then
find curvefs/src curvefs/test -name '*.h' -or -name '*.cpp'
else
die "please specify storage type: bs or fs\n"
fi
}
run_check() {
cpplint \
--linelength=80 \
--counting=detailed \
--output=junit \
--filter=-build/c++11 \
--quiet $( get_files ) 2>&1 \
| xq
}
############################ MAIN()
main() {
source "util/basic.sh"
precheck
run_check
}
main "$@"