Skip to content
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

Match cocoapods static analyzer settings, fix issues #897

Merged
merged 4 commits into from
Feb 21, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## 12.X.X 2018-XX-XX
* Now matches clang static analyzer settings with Cocoapods, so you won't see any more analyzer issues.

## 12.1.0 2018-02-05
* Adds `createCardSources` to `STPPaymentConfiguration`. If you enable this option, when your user adds a card in the SDK's UI, a card source will be created and attached to their Stripe Customer. If this option is disabled (the default), a card token is created. For more information on card sources, see https://stripe.com/docs/sources/cards

Expand Down
6 changes: 6 additions & 0 deletions Stripe/BuildConfigurations/Project-Shared.xcconfig
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,12 @@ CLANG_WARN_UNREACHABLE_CODE = YES
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;


CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;

// Default value is YES_NONAGGRESSIVE. YES is "Yes, Aggressive" in Xcode 9 UI
CLANG_ANALYZER_NONNULL = YES;


CLANG_WARN_INFINITE_RECURSION = YES;


Expand Down
2 changes: 1 addition & 1 deletion Stripe/STPAPIRequest.m
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ + (void)parseResponse:(NSURLResponse *)response
// Some deserializers don't conform to STPInternalAPIResponseDecodable
deserializerClass = [deserializers.firstObject class];
}
else {
else if (objectString != nil) {
for (id<STPAPIResponseDecodable> deserializer in deserializers) {
if ([deserializer respondsToSelector:@selector(stripeObject)]
&& [[(id<STPInternalAPIResponseDecodable>)deserializer stripeObject] isEqualToString:objectString]) {
Expand Down
2 changes: 1 addition & 1 deletion Stripe/STPAddress.m
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ + (PKAddressField)pkAddressFieldsFromStripeContactFields:(NSSet<STPContactField>

for (STPContactField contactField in contactFields) {
NSNumber *boxedConvertedField = contactToAddressFieldMap[contactField];
if (boxedConvertedField) {
if (boxedConvertedField != nil) {
addressFields = (PKAddressField) (addressFields | [boxedConvertedField unsignedIntegerValue]);
}
}
Expand Down
2 changes: 1 addition & 1 deletion Stripe/STPBankAccount.m
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ + (STPBankAccountStatus)statusFromString:(NSString *)string {
NSString *key = [string lowercaseString];
NSNumber *statusNumber = [self stringToStatusMapping][key];

if (statusNumber) {
if (statusNumber != nil) {
return (STPBankAccountStatus)[statusNumber integerValue];
}

Expand Down
2 changes: 1 addition & 1 deletion Stripe/STPBankAccountParams.m
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ + (STPBankAccountHolderType)accountHolderTypeFromString:(NSString *)string {
NSString *key = [string lowercaseString];
NSNumber *accountHolderTypeNumber = [self stringToAccountHolderTypeMapping][key];

if (accountHolderTypeNumber) {
if (accountHolderTypeNumber != nil) {
return (STPBankAccountHolderType)[accountHolderTypeNumber integerValue];
}

Expand Down
4 changes: 2 additions & 2 deletions Stripe/STPCard.m
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ + (STPCardFundingType)fundingFromString:(NSString *)string {
NSString *key = [string lowercaseString];
NSNumber *fundingNumber = [self stringToFundingMapping][key];

if (fundingNumber) {
if (fundingNumber != nil) {
return (STPCardFundingType)[fundingNumber integerValue];
}

Expand Down Expand Up @@ -181,7 +181,7 @@ + (nullable instancetype)decodedObjectFromAPIResponse:(nullable NSDictionary *)r
NSString *rawBrand = [dict stp_stringForKey:@"brand"];
NSNumber *rawExpMonth = [dict stp_numberForKey:@"exp_month"];
NSNumber *rawExpYear = [dict stp_numberForKey:@"exp_year"];
if (!stripeId || !last4 || !rawBrand || !rawExpMonth || !rawExpYear) {
if (stripeId == nil || last4 == nil || rawBrand == nil || rawExpMonth == nil || rawExpYear == nil) {
return nil;
}

Expand Down
4 changes: 2 additions & 2 deletions Stripe/STPFile.m
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ + (STPFilePurpose)purposeFromString:(NSString *)string {
NSString *key = [string lowercaseString];
NSNumber *purposeNumber = [self stringToPurposeMapping][key];

if (purposeNumber) {
if (purposeNumber != nil) {
return (STPFilePurpose)[purposeNumber integerValue];
}

Expand Down Expand Up @@ -88,7 +88,7 @@ + (instancetype)decodedObjectFromAPIResponse:(NSDictionary *)response {
NSNumber *size = [dict stp_numberForKey:@"size"];
NSString *type = [dict stp_stringForKey:@"type"];
NSString *rawPurpose = [dict stp_stringForKey:@"purpose"];
if (!stripeId || !created || !size || !type || !rawPurpose) {
if (stripeId == nil || created == nil || size == nil || type == nil || rawPurpose == nil) {
return nil;
}

Expand Down
8 changes: 4 additions & 4 deletions Stripe/STPSource.m
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ + (STPSourceType)typeFromString:(NSString *)string {
NSString *key = [string lowercaseString];
NSNumber *typeNumber = [self stringToTypeMapping][key];

if (typeNumber) {
if (typeNumber != nil) {
return (STPSourceType)[typeNumber integerValue];
}

Expand All @@ -94,7 +94,7 @@ + (STPSourceFlow)flowFromString:(NSString *)string {
NSString *key = [string lowercaseString];
NSNumber *flowNumber = [self stringToFlowMapping][key];

if (flowNumber) {
if (flowNumber != nil) {
return (STPSourceFlow)[flowNumber integerValue];
}

Expand All @@ -121,7 +121,7 @@ + (STPSourceStatus)statusFromString:(NSString *)string {
NSString *key = [string lowercaseString];
NSNumber *statusNumber = [self stringToStatusMapping][key];

if (statusNumber) {
if (statusNumber != nil) {
return (STPSourceStatus)[statusNumber integerValue];
}

Expand All @@ -145,7 +145,7 @@ + (STPSourceUsage)usageFromString:(NSString *)string {
NSString *key = [string lowercaseString];
NSNumber *usageNumber = [self stringToUsageMapping][key];

if (usageNumber) {
if (usageNumber != nil) {
return (STPSourceUsage)[usageNumber integerValue];
}

Expand Down
2 changes: 1 addition & 1 deletion Stripe/STPSourceCardDetails.m
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ + (STPSourceCard3DSecureStatus)threeDSecureStatusFromString:(NSString *)string {
NSString *key = [string lowercaseString];
NSNumber *threeDSecureStatusNumber = [self stringToThreeDSecureStatusMapping][key];

if (threeDSecureStatusNumber) {
if (threeDSecureStatusNumber != nil) {
return (STPSourceCard3DSecureStatus)[threeDSecureStatusNumber integerValue];
}

Expand Down
2 changes: 1 addition & 1 deletion Stripe/STPSourceRedirect.m
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ + (STPSourceRedirectStatus)statusFromString:(NSString *)string {
NSString *key = [string lowercaseString];
NSNumber *statusNumber = [self stringToStatusMapping][key];

if (statusNumber) {
if (statusNumber != nil) {
return (STPSourceRedirectStatus)[statusNumber integerValue];
}

Expand Down
2 changes: 1 addition & 1 deletion Stripe/STPSourceVerification.m
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ + (STPSourceVerificationStatus)statusFromString:(NSString *)string {
NSString *key = [string lowercaseString];
NSNumber *statusNumber = [self stringToStatusMapping][key];

if (statusNumber) {
if (statusNumber != nil) {
return (STPSourceVerificationStatus)[statusNumber integerValue];
}

Expand Down
2 changes: 1 addition & 1 deletion Stripe/STPTheme.m
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ - (void)setBarStyle:(UIBarStyle)barStyle {
}

- (UIBarStyle)barStyle {
if (_internalBarStyle) {
if (_internalBarStyle != nil) {
return [_internalBarStyle integerValue];
}
return [self barStyleForColor:self.secondaryBackgroundColor];
Expand Down