-
Notifications
You must be signed in to change notification settings - Fork 28.6k
pigeon objc static analysis problem with ternary conditional nil checks #63966
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Would be nice to run the static analyzer in CI for https://github.com/flutter/packages/tree/cf96cba3c50a410e9b450d0a24ea9d7e1c020c09/packages/pigeon/platform_tests/ios_unit_tests/ios to catch future issues. |
@jmagman I was looking into it. It's not clear what linter cocoapods uses. I was playing around with oclint but might take a bit of work to setup since it doesn't seem to support commandline compiler arguments. Otherwise I'll have to generate a fake podspec to run "pod lib lint" =T |
It's just the clang static analyzer with default warnings from a newly generated Xcode project. You don't need to use CocoaPods to see it. |
If the unit tests were running, I think you could add |
After the ios_unit_tests have been reenabled i tried: cd platform_tests/ios_unit_tests/ios
xcodebuild analyze DEVELOPMENT_TEAM=$DEVELOPMENT_TEAM GCC_TREAT_WARNINGS_AS_ERRORS=YES Despite "messages.m" containing: - (NSDictionary *)toMap {
return [NSDictionary
dictionaryWithObjectsAndKeys:(self.query ? self.query : [NSNull null]), @"query",
(self.anInt ? self.anInt : [NSNull null]), @"anInt",
(self.aBool ? self.aBool : [NSNull null]), @"aBool", nil];
} The analyzer didn't trigger any messages. I tried to trigger problems in messages.m, like adding unused ivars, but couldn't get the analyzer to complain. edit: Running the analyzer inside of xcode didn't flag the issue either. |
I was finally able to get the analyzer to trigger a problem by turning on |
It should be coming from - (NSDictionary *)toMap {
return [NSDictionary
dictionaryWithObjectsAndKeys:(self.textureId ? self.textureId : [NSNull null]),
@"textureId", nil];
} |
I have I can still turn on the analyzer and we should be good as long as the analyzers never conflict and we accept there may be certain issues it doesn't catch that other variants will flag like this one. |
@gaaclarke The
Did you try it on the |
@jmagman Right, I know it's different. I was just showing that the analyzer flagged that problem, but not the one for CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION. |
Uh oh!
There was an error while loading. Please reload this page.
From @jmagman:
Spawned from:
flutter/plugins#2922
The text was updated successfully, but these errors were encountered: