-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjenkins_github_checkwarn.sh
executable file
·84 lines (68 loc) · 2.24 KB
/
jenkins_github_checkwarn.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#!/bin/bash -uex
# comma separated list
def_ignore="SPLIT_STRING,SSCANF_TO_KSTRTO,PREFER_KERNEL_TYPES,BRACES"
def_ignore+=",USE_NEGATIVE_ERRNO,CAMELCASE,STATIC_CONST_CHAR_ARRAY,SPACING"
: "${IGNORE:="${def_ignore}"}"
mydir="$(dirname "${0}")"
if [ -n "${GERRIT_PROJECT-}" ]; then
checkpatch_py="gerrit_checkpatch.py"
else
checkpatch_py="github_checkpatch.py"
fi
checkpatch_py="$(find -L "${mydir}" -name $checkpatch_py -print -quit)"
check_make="$(find -L "${mydir}" -name check_make_output.sh -print -quit)"
check_style="$(find -L "${mydir}" -name checkpatch.pl -print -quit)"
check_shell="$(find -L "${mydir}" -name shellcheck_scripts.sh -print -quit)"
check_python="$(find -L "${mydir}" -name check_python.sh -print -quit)"
# For a matrix review we only want to default for the full check for the
# el7 target, just compiler warnings for the rest.
set +u
# shellcheck disable=SC2154
if [ -n "${distro}" ]; then
if [ "${distro}" != 'el7' ]; then
: "${FULL_REVIEW:=0}"
fi
fi
: "${FULL_REVIEW:=1}"
set -u
# colon separated list
def_checkpatch_paths="${check_make}"
if [ "${FULL_REVIEW}" -ne 0 ]; then
# Only do style checking if not performed by GitHub.
if [ ! -e .github/workflows/clang-format.yml ]; then
def_checkpatch_paths+=":${check_style}"
fi
# Skip pylint checking if performed by GitHub.
if [ -e .github/workflows/pylint.yml ]; then
def_checkpatch_paths+=":${check_shell}"
else
def_checkpatch_paths+=":${check_shell}:${check_python}"
fi
fi
: "${CHECKPATCH_PATHS:="${def_checkpatch_paths}"}"
export CHECKPATCH_PATHS
: "${CHECKPATCH_ARGS:="--notree --show-types --ignore $IGNORE -"}"
export CHECKPATCH_ARGS
# Comma separated list
def_ignored_files="code_review/checkpatch.pl"
: "${CHECKPATCH_IGNORED_FILES:="${def_ignored_files}"}"
export CHECKPATCH_IGNORED_FILES
set +u
if [ -n "${CORAL_ARTIFACTS}" ]; then
REVIEW_HISTORY_BASE="${CORAL_ARTIFACTS}"/"${JOB_NAME}"
fi
set -u
: "${REVIEW_HISTORY_BASE:="${PWD}"}"
export REVIEW_HISTORY_PATH="${REVIEW_HISTORY_BASE}"/REVIEW_HISTORY
if [ ! -e "$REVIEW_HISTORY_PATH" ]; then
mkdir -p "${REVIEW_HISTORY_BASE}"
touch "${REVIEW_HISTORY_PATH}"
fi
if [ -f ./ci/patch_src_in_place ]
then
./ci/patch_src_in_place
fi
python3 "${checkpatch_py}"
result=$?
git checkout .
exit ${result}