SaiXu
(sai)
April 2, 2020, 5:31am
#1
Hi,
My company is using SonarQube of Enterprise Edition Version 7.9.1 (build 27448).
We are using sonar c-family plugin to scan the OC project, the command is like below:
build-wrapper-macosx-x86 --out-dir build_wrapper_out_dir_ut xcodebuild clean build test -workspace “XXXX.xcworkspace” -scheme “YYYY” -sdk “iphonesimulator13.2” -destination “platform=iOS Simulator,OS=13.3,name=iPhone 11" -configuration Release MAIN_PROFILE=“ZZZZZZ”
After sonar client uploaded the issues to sonar server, we found some false positive issues like:
The orignal code is like below, (
_timerInterval
and
timerInterval
are defined as the same type)
I wound why sonar scan report So obvious false positive issues?
Thanks/Sai
Antoine
(Antoine)
April 3, 2020, 8:26am
#2
Hey @SaiXu ,
Your screenshot indeed indicates that timerInterval
is of type NSTimeInterval
, though we can’t see the definition of _timerInterval
.
Could you attach more of your code so we can really assess if it’s a FP or not?
SaiXu
(sai)
April 6, 2020, 4:00am
#3
Hi @Antoine , thanks for you reply. From the Objective’s grammar, @property (nonatomic, assign) NSTimeInterval timerInterval
means there is a property named _timerInterval
with type of NStimeInterval
of this class. Please refer to https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/ProgrammingWithObjectiveC/EncapsulatingData/EncapsulatingData.html
BTW, if I execute build-wrapper-macosx-x86
with build
(not test
), there’s no false positive.