-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathoclint-script.yaml
37 lines (28 loc) · 1.11 KB
/
oclint-script.yaml
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
hash oclint &> /dev/null
if [ $? -eq 1 ]; then
echo >&2 "oclint not found, analyzing stopped"
exit 1
fi
cd "${TARGET_TEMP_DIR}"
if [ ! -f compile_commands.json ]; then
echo "[*] compile_commands.json not found, possibly clean was performed"
echo "[*] starting xcodebuild to rebuild the project.."
# clean previous output
if [ -f xcodebuild.log ]; then
rm xcodebuild.log
fi
cd "${SRCROOT}"
xcodebuild clean
#build xcodebuild.log
xcodebuild | tee "${TARGET_TEMP_DIR}/xcodebuild.log"
#xcodebuild <options>| tee ${TARGET_TEMP_DIR}/xcodebuild.log
echo "[*] transforming xcodebuild.log into compile_commands.json..."
cd "${TARGET_TEMP_DIR}"
#transform it into compile_commands.json
oclint-xcodebuild
echo "[*] copy compile_commands.json to the project root..."
cp "${TARGET_TEMP_DIR}/compile_commands.json" "${SRCROOT}/compile_commands.json"
fi
echo "[*] starting analyzing"
cd ${TARGET_TEMP_DIR}
oclint-json-compilation-database oclint_args oclint_args "-disable-rule=FeatureEnvy -disable-rule=IvarAssignmentOutsideAccessorsOrInit -rc LONG_LINE=1000 -rc LONG_VARIABLE_NAME=100" | sed 's/\(.*\.\m\{1,2\}:[0-9]*:[0-9]*:\)/\1 warning:/'