Skip to content

Instantly share code, notes, and snippets.

@netbe
Last active August 29, 2015 13:56
Show Gist options
  • Save netbe/8972112 to your computer and use it in GitHub Desktop.
Save netbe/8972112 to your computer and use it in GitHub Desktop.
if [ -f ~/.bash_profile ]; then
source ~/.bash_profile
fi
if [ -f ~/.zshrc ]; then
source ~/.zshrc
fi
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
echo "[*] transforming xcodebuild.log into compile_commands.json..."
cd "${TARGET_TEMP_DIR}"
#transform it into compile_commands.json
oclint-xcodebuild
fi
#if [-d report.html]; then
#rm report.html
#fi
#run static analyzer
#oclint-json-compilation-database -- -o=./report.html -html
echo "[*] starting analyzing"
cd "${TARGET_TEMP_DIR}"
oclint-json-compilation-database -- -p "${TARGET_TEMP_DIR}" | sed 's/\(.*\.\m\{1,2\}:[0-9]*:[0-9]*:\)/\1 warning:/'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment