-
What language is this for?
Objective-C -
Which rule?
S1854 - Unused assignments should be removed -
Are you using
SonarQube - I think it’s 8.x, trying to get precision on this from our devops. -
How can we reproduce the problem? Give us a self-contained snippet of code (formatted text, no screenshots)
@property (nonatomic, strong) dispatch_queue_t syncQueue;
@property (nonatomic, strong) NSMutableDictionary<NSNumber *, NSNumber*> *threadSafeDict;
-(void)updateDictValue:(NSUInteger)value forKey:(NSUInteger *)key {
dispatch_barrier_async(_syncQueue, ^{
NSNumber *key = [NSNumber numberWithUnsignedInteger:key]; // (1)
_threadSafeDict[key] = [NSNumber numberWithUnsignedInteger:value];
});
}
(1) triggers Value stored to ‘key’ during its initialization is never read
- Why do you believe it’s a false-positive/false-negative?
key
is used immediately in the next line.