Skip to content

Instantly share code, notes, and snippets.

@kwontaewan
Last active May 9, 2018 09:25
Show Gist options
  • Save kwontaewan/827ec47ae9d4c5a9a98ef2a96c15478e to your computer and use it in GitHub Desktop.
Save kwontaewan/827ec47ae9d4c5a9a98ef2a96c15478e to your computer and use it in GitHub Desktop.
#oclint xcode include cocoapod project
OCLINT_HOME=/usr/local/Cellar/oclint/0.13
export PATH=$OCLINT_HOME/bin:$PATH
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 "Workspace Path : ${MY_WORKSPACE}"
echo "[*] starting xcodebuild to rebuild the project.."
# clean previous output
if [ -f xcodebuild.log ]; then
rm xcodebuild.log
echo "Oclint Clean performed"
fi
cd ${SRCROOT}
xcodebuild clean
#build xcodebuild.log
xcodebuild ONLY_ACTIVE_ARCH=NO COMPILER_INDEX_STORE_ENABLE=NO -workspace ${PROJECT_NAME}.xcworkspace -scheme ${PROJECT_NAME} -configuration Debug clean build| 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
fi
echo "[*] starting analyzing"
cd ${TARGET_TEMP_DIR}
oclint-json-compilation-database -e /Users/seongjae/Desktop/lpoint_demo/1.1.4/ios/NuriPay/Pods/ -- -stats -max-priority-1=1000 -max-priority-2=1000 -max-priority-3=1000 -rc LONG_LINE=500 -rc LONG_VARIABLE_NAME=100 -rc LONG_METHOD=350 -report-type=html -o /Users/seongjae/Desktop/oclint.html| sed 's/\(.*\.\m\{1,2\}:[0-9]*:[0-9]*:\)/\1 warning:/'
#oclint-json-compilation-database -e /Users/seongjae/Desktop/lpoint_demo/1.1.4/ios/NuriPay/Pods/ -v oclint_args | 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