Nullable/nonnull check for Obj-c


One thing that I’ve found useful from a similar project in Android was the check for @Nullable/@NonNull that is possible to add everywhere and it’s being checked by Android Studio.

For objective-c and iOs Xcode checks for nullable/nonnull for method calls and returns, but it won’t check for variables used in methods.

I’ve looked around and only this abandoned tools seems to be doing that:

I’ve searched for the rules used for Objective-c for SonarSource here and did not find any mention for nullable/nonnull

Just wanted to confirm if that is the case or not.

Hi @nonelse,

you have rule S2637 which does that, you can check it on your SonarQube instance.

Thanks for the reply @mpaladin!

I’m not 100% sure, but that rule seems to apply to Java only, and not to Obj-c as I was asking about.

The Nullable/NonNull rule is already applied by Android Studio, so using SonarQube would be just a different source for that.

Hi @nonelse,

I can confirm you that the rule is available for Objective-C since SonarCFamily 6.5 (CPP-2312), I invite you to upgrade SonarCFamily analyzer in your SonarQube instance to its latest version 6.7.