From 0da1a9864de4ce58ae4be783c985de3fd695afb1 Mon Sep 17 00:00:00 2001 From: Paul Beusterien Date: Tue, 3 Mar 2026 10:07:51 -0800 Subject: [PATCH 1/2] [Infra] clang-format 22 updates --- .../Components/FIRCLSApplication.m | 4 ++-- .../UnitTests/FIRCLSCompactUnwindTests.m | 2 +- Crashlytics/UnitTests/FIRCLSDwarfTests.m | 2 +- FirebaseMessaging/Sources/FIRMessaging.m | 8 +++---- ...FIRMessagingRemoteNotificationsProxyTest.m | 12 +++++------ .../FPRNSURLSessionDelegateInstrument.m | 21 ++++++++++--------- .../Tests/SpecTests/FSTMockDatastore.mm | 18 ++++++---------- 7 files changed, 31 insertions(+), 36 deletions(-) diff --git a/Crashlytics/Crashlytics/Components/FIRCLSApplication.m b/Crashlytics/Crashlytics/Components/FIRCLSApplication.m index 67e452bd84d..19bb621c32e 100644 --- a/Crashlytics/Crashlytics/Components/FIRCLSApplication.m +++ b/Crashlytics/Crashlytics/Components/FIRCLSApplication.m @@ -156,8 +156,8 @@ id FIRCLSApplicationSharedInstance(void) { #endif id FIRCLSApplicationBeginActivity(NSActivityOptions options, NSString* reason) { - if ([[NSProcessInfo processInfo] respondsToSelector:@selector(beginActivityWithOptions: - reason:)]) { + if ([[NSProcessInfo processInfo] + respondsToSelector:@selector(beginActivityWithOptions:reason:)]) { return [[NSProcessInfo processInfo] beginActivityWithOptions:options reason:reason]; } diff --git a/Crashlytics/UnitTests/FIRCLSCompactUnwindTests.m b/Crashlytics/UnitTests/FIRCLSCompactUnwindTests.m index fc5bcabf73a..53fcf891b9d 100644 --- a/Crashlytics/UnitTests/FIRCLSCompactUnwindTests.m +++ b/Crashlytics/UnitTests/FIRCLSCompactUnwindTests.m @@ -46,7 +46,7 @@ - (NSString*)resourcePath { NSBundle* bundle = SWIFTPM_MODULE_BUNDLE; return [bundle.resourcePath stringByAppendingPathComponent:@"Data"]; #else - NSBundle *bundle = [NSBundle bundleForClass:[self class]]; + NSBundle* bundle = [NSBundle bundleForClass:[self class]]; return bundle.resourcePath; #endif } diff --git a/Crashlytics/UnitTests/FIRCLSDwarfTests.m b/Crashlytics/UnitTests/FIRCLSDwarfTests.m index 7a97afa1abb..d9aebda4042 100644 --- a/Crashlytics/UnitTests/FIRCLSDwarfTests.m +++ b/Crashlytics/UnitTests/FIRCLSDwarfTests.m @@ -46,7 +46,7 @@ - (NSString*)resourcePath { NSBundle* bundle = SWIFTPM_MODULE_BUNDLE; return [bundle.resourcePath stringByAppendingPathComponent:@"Data"]; #else - NSBundle *bundle = [NSBundle bundleForClass:[self class]]; + NSBundle* bundle = [NSBundle bundleForClass:[self class]]; return bundle.resourcePath; #endif } diff --git a/FirebaseMessaging/Sources/FIRMessaging.m b/FirebaseMessaging/Sources/FIRMessaging.m index 3eb83e94e5f..f8a696516a2 100644 --- a/FirebaseMessaging/Sources/FIRMessaging.m +++ b/FirebaseMessaging/Sources/FIRMessaging.m @@ -391,8 +391,8 @@ - (void)handleIncomingLinkIfNeededFromMessage:(NSDictionary *)message { return; } id appDelegate = application.delegate; - SEL continueUserActivitySelector = @selector(application: - continueUserActivity:restorationHandler:); + SEL continueUserActivitySelector = + @selector(application:continueUserActivity:restorationHandler:); // Due to FIRAAppDelegateProxy swizzling, this selector will most likely get chosen, whether or // not the actual application has implemented @@ -617,8 +617,8 @@ - (void)setDelegate:(id)delegate { // NOTE: Once |didReceiveRegistrationToken:| can be made a required method, this // check can be removed. - (void)validateDelegateConformsToTokenAvailabilityMethods { - if (self.delegate && ![self.delegate respondsToSelector:@selector(messaging: - didReceiveRegistrationToken:)]) { + if (self.delegate && + ![self.delegate respondsToSelector:@selector(messaging:didReceiveRegistrationToken:)]) { FIRMessagingLoggerWarn(kFIRMessagingMessageCodeTokenDelegateMethodsNotImplemented, @"The object %@ does not respond to " @"-messaging:didReceiveRegistrationToken:. Please implement " diff --git a/FirebaseMessaging/Tests/UnitTests/FIRMessagingRemoteNotificationsProxyTest.m b/FirebaseMessaging/Tests/UnitTests/FIRMessagingRemoteNotificationsProxyTest.m index aeec6002d1c..d4b78ea5080 100644 --- a/FirebaseMessaging/Tests/UnitTests/FIRMessagingRemoteNotificationsProxyTest.m +++ b/FirebaseMessaging/Tests/UnitTests/FIRMessagingRemoteNotificationsProxyTest.m @@ -221,8 +221,8 @@ - (void)testIncompleteAppDelegateRemoteNotificationWithFetchHandlerMethod { [self.proxy swizzleMethodsIfPossible]; #if TARGET_OS_IOS || TARGET_OS_TV - SEL remoteNotificationWithFetchHandler = @selector(application: - didReceiveRemoteNotification:fetchCompletionHandler:); + SEL remoteNotificationWithFetchHandler = + @selector(application:didReceiveRemoteNotification:fetchCompletionHandler:); XCTAssertTrue([incompleteAppDelegate respondsToSelector:remoteNotificationWithFetchHandler]); #endif // TARGET_OS_IOS || TARGET_OS_TV @@ -319,11 +319,11 @@ - (void)testIncompleteUserNotificationCenterDelegateMethod { // Because the incomplete delete does not implement either of the optional delegate methods, we // should swizzle nothing. If we had swizzled them, then respondsToSelector: would return YES // even though the delegate does not implement the methods. - SEL willPresentSelector = @selector(userNotificationCenter: - willPresentNotification:withCompletionHandler:); + SEL willPresentSelector = + @selector(userNotificationCenter:willPresentNotification:withCompletionHandler:); XCTAssertFalse([delegate respondsToSelector:willPresentSelector]); - SEL didReceiveResponseSelector = @selector(userNotificationCenter: - didReceiveNotificationResponse:withCompletionHandler:); + SEL didReceiveResponseSelector = + @selector(userNotificationCenter:didReceiveNotificationResponse:withCompletionHandler:); XCTAssertFalse([delegate respondsToSelector:didReceiveResponseSelector]); } } diff --git a/FirebasePerformance/Sources/Instrumentation/Network/Delegates/FPRNSURLSessionDelegateInstrument.m b/FirebasePerformance/Sources/Instrumentation/Network/Delegates/FPRNSURLSessionDelegateInstrument.m index c636d3e2ba7..d9df5b2060a 100644 --- a/FirebasePerformance/Sources/Instrumentation/Network/Delegates/FPRNSURLSessionDelegateInstrument.m +++ b/FirebasePerformance/Sources/Instrumentation/Network/Delegates/FPRNSURLSessionDelegateInstrument.m @@ -71,8 +71,8 @@ void InstrumentURLSessionTaskDidCompleteWithError(FPRClassInstrumentor *instrume NS_EXTENSION_UNAVAILABLE("Firebase Performance is not supported for extensions.") void InstrumentURLSessionTaskDidSendBodyDataTotalBytesSentTotalBytesExpectedToSend( FPRClassInstrumentor *instrumentor) { - SEL selector = @selector(URLSession: - task:didSendBodyData:totalBytesSent:totalBytesExpectedToSend:); + SEL selector = + @selector(URLSession:task:didSendBodyData:totalBytesSent:totalBytesExpectedToSend:); FPRSelectorInstrumentor *selectorInstrumentor = [instrumentor instrumentorForInstanceSelector:selector]; if (selectorInstrumentor) { @@ -159,8 +159,8 @@ void InstrumentURLSessionDownloadTaskDidFinishDownloadToURL(FPRClassInstrumentor NS_EXTENSION_UNAVAILABLE("Firebase Performance is not supported for extensions.") void InstrumentURLSessionDownloadTaskDidWriteDataTotalBytesWrittenTotalBytesExpectedToWrite( FPRClassInstrumentor *instrumentor) { - SEL selector = @selector(URLSession: - downloadTask:didWriteData:totalBytesWritten:totalBytesExpectedToWrite:); + SEL selector = + @selector(URLSession:downloadTask:didWriteData:totalBytesWritten:totalBytesExpectedToWrite:); FPRSelectorInstrumentor *selectorInstrumentor = [instrumentor instrumentorForInstanceSelector:selector]; if (selectorInstrumentor) { @@ -244,9 +244,9 @@ - (void)registerObject:(id)object { // Register the non-swizzled versions of these methods. // NSURLSessionTaskDelegate methods. CopySelector(@selector(URLSession:task:didCompleteWithError:), instrumentor); - CopySelector(@selector(URLSession: - task:didSendBodyData:totalBytesSent:totalBytesExpectedToSend:), - instrumentor); + CopySelector( + @selector(URLSession:task:didSendBodyData:totalBytesSent:totalBytesExpectedToSend:), + instrumentor); // NSURLSessionDataDelegate methods. CopySelector(@selector(URLSession:dataTask:didReceiveData:), instrumentor); @@ -255,9 +255,10 @@ - (void)registerObject:(id)object { CopySelector(@selector(URLSession:downloadTask:didFinishDownloadingToURL:), instrumentor); CopySelector(@selector(URLSession:downloadTask:didResumeAtOffset:expectedTotalBytes:), instrumentor); - CopySelector(@selector(URLSession: - downloadTask:didWriteData:totalBytesWritten:totalBytesExpectedToWrite:), - instrumentor); + CopySelector( + @selector( + URLSession:downloadTask:didWriteData:totalBytesWritten:totalBytesExpectedToWrite:), + instrumentor); [instrumentor swizzle]; }); diff --git a/Firestore/Example/Tests/SpecTests/FSTMockDatastore.mm b/Firestore/Example/Tests/SpecTests/FSTMockDatastore.mm index d75302e77d9..684fccfa733 100644 --- a/Firestore/Example/Tests/SpecTests/FSTMockDatastore.mm +++ b/Firestore/Example/Tests/SpecTests/FSTMockDatastore.mm @@ -75,12 +75,9 @@ GrpcConnection* grpc_connection, WatchStreamCallback* callback, MockDatastore* datastore) - : WatchStream{worker_queue, - auth_credentials_provider, - app_check_credentials_provider, - std::move(serializer), - grpc_connection, - callback}, + : WatchStream{ + worker_queue, auth_credentials_provider, app_check_credentials_provider, + std::move(serializer), grpc_connection, callback}, datastore_{datastore}, callback_{callback} { } @@ -177,12 +174,9 @@ void WriteWatchChange(const WatchChange& change, SnapshotVersion snap) { GrpcConnection* grpc_connection, WriteStreamCallback* callback, MockDatastore* datastore) - : WriteStream{worker_queue, - auth_credentials_provider, - app_check_credentials_provider, - std::move(serializer), - grpc_connection, - callback}, + : WriteStream{ + worker_queue, auth_credentials_provider, app_check_credentials_provider, + std::move(serializer), grpc_connection, callback}, datastore_{datastore}, callback_{callback} { } From 3611ef9a0e1e97c5a6456daae983cdf12e61f8c1 Mon Sep 17 00:00:00 2001 From: Paul Beusterien Date: Tue, 3 Mar 2026 10:19:49 -0800 Subject: [PATCH 2/2] fix error message --- scripts/style.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/style.sh b/scripts/style.sh index 47c39e3075d..d6976d51634 100755 --- a/scripts/style.sh +++ b/scripts/style.sh @@ -65,7 +65,7 @@ case "$version" in exit 1 ;; *) - echo "Please upgrade to clang-format version 21." + echo "Please upgrade to clang-format version 22." echo "If it's installed via homebrew you can run:" echo "brew upgrade clang-format" exit 1