longyiqi/oclint — Issue #10: Unused block parameters in method declarations should be ignored
Author: lqi
Created: 2011-11-04 16:02:15+00:00
State: open
Labels: false positive

- (NSArray *)collect:(id (^)(id obj))block {
return [self map:block];
}

- (NSArray *)map:(id (^)(id obj))block {
NSMutableArray *projections = [NSMutableArray arrayWithCapacity:[self count]];
for (id obj in self) {
[projections addObject:block(obj)];
}
return projections;
}

In this sample code, we treat block parameter _(id obj)_ in _collect_ method as an unused method parameter by mistake, because it's a requirement to call another method _map_.