facebook / infer

A static analyzer for Java, C, C++, and Objective-C
http://fbinfer.com/
MIT License
14.9k stars 2.01k forks source link

Objective-C - warnings for isEqual and hash #100

Open markohlebar opened 9 years ago

markohlebar commented 9 years ago

Sometimes it happens that a developer implements -(BOOL)isEqual:(id)otherObject, but then forgets to implement - (NSUInteger)hash in that class. This can lead to hard to debug behaviour when instances of that class are used in collections. Could this be a candidate for a warning?

GeekMin commented 9 years ago

maybe u can find some other tools having realized this feature: like oclint? https://github.com/oclint/oclint/blob/master/oclint-rules/rules/cocoa/ObjCVerifyIsEqualHashRule.cpp

markohlebar commented 9 years ago

@GeekMin good point, our linter didn't pick this up :)