This question already has an answer here:
OCLint not in system path
                                
                                    (1个答案)
                                
                        
                                4年前关闭。
            
                    
使用以下脚本创建新的聚合目标后,出现这些错误:

错误:

oclint not found, analyzing stopped
Command /bin/sh failed with exit code 1


运行脚本外壳:/ bin / sh

脚本:

source ~/.bash_profile

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 | sed 's/\(.*\.\m\{1,2\}:[0-9]*:[0-9]*:\)/\1 warning:/'


我是否必须将xcode默认脚本更改为bash?我该怎么办?

最佳答案

您的路径中没有OCLint。
要在路径中使用OCLint,可以尝试删除

source ~/.bash_profile


并替换为

OCLINT_HOME= **path to OClint downloaded and extracted folder**
export PATH=$OCLINT_HOME/bin:$PATH


您可以尝试此链接以获取帮助:https://stackoverflow.com/a/30053104/3141464

关于ios - Xcodebuild Shell错误的OCLint ,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/30124799/

10-10 19:43