2

We have integrated OCLint in one of our project with below script.

source ~/.bash_profile
export PATH=$PATH:/usr/local/bin/

if [ -z "${SCHEME+x}" ]
then
export SCHEME="${PROJECT_NAME}"
fi

if [ -z "${WORKSPACE+x}" ]
then
export WORKSPACE="${PROJECT_NAME}.xcworkspace"
fi

cd "${SOURCE_ROOT}"

# Check if xctool and oclint are installed
if ! which -s xctool
then
echo 'error: xctool not found, install e.g. with homebrew'
exit 1
fi

if ! which -s oclint-json-compilation-database
then
echo 'error: OCLint not installed, install e.g. with homebrew cask'
exit 2
fi

# Cleanup before building
rm -f compile_commands.json
xctool -workspace "${WORKSPACE}" -scheme "${SCHEME}" clean > /dev/null

# Build and analyze
# OCLint Rule Index: http://docs.oclint.org/en/dev/rules/index.html
xctool -workspace "${WORKSPACE}" -scheme "${SCHEME}" -reporter json-compilation-database:compile_commands.json build
oclint-json-compilation-database -e Pods -- -max-priority-1=100000 -max-priority-2=100000 -max-priority-3=100000 \

# Final cleanup
rm -f compile_commands.json

It gives 'zero' warnings and 'zero' error though code contains the lots of warnings and errors.

It seems that it was working fine with old XCodes but not working with XCode 9.2.

Can anyone tell us what kind of changes required to run the OCLint in xcode 9.2 perfectly ?

We are expecting that xcode will show the warnings when we build the OCLint schema. But we are not getting any result now.

Please guide us if we are doing something wrong.

iDev
  • 531
  • 1
  • 5
  • 15

1 Answers1

0

We faced a similar challenge few days back when we upgraded from xcode 8.2.1 to xcode 9.2 with oclint 0.11 Can you try upgrading to oclint-0.13.1 and do a retry and see if it helps.

There are some other tweaks also present but not sure that will fit or not ?

https://github.com/oclint/oclint/issues/245 (search texts for -fmodules and -gmodules, and delete all matches.)

https://github.com/oclint/oclint/issues/302 (set CLANG_ENABLE_MODULE_DEBUGGING=NO)