From 5469bf5bdc9ad910d8f33bcf153ba1122cfd81fd Mon Sep 17 00:00:00 2001 From: Gio Lodi Date: Mon, 4 May 2026 12:45:47 +1000 Subject: [PATCH] Enable SwiftLint rule: unused_closure_parameter Part of the Orchard SwiftLint rollout campaign. 7 violations auto-fixed to `_`. --- Generated with the help of Claude Code, https://claude.com/claude-code Co-Authored-By: Claude Opus 4.7 (1M context) --- .swiftlint.yml | 3 +++ Sources/Experiments/ExPlatService.swift | 2 +- Tests/Tests/Event Logging/EventLoggingTests.swift | 4 ++-- .../Tests/Event Logging/EventLoggingUploadManagerTests.swift | 4 ++-- Tests/Tests/TracksEventPersistenceServiceTests.swift | 4 ++-- 5 files changed, 10 insertions(+), 7 deletions(-) diff --git a/.swiftlint.yml b/.swiftlint.yml index 05386677..9ffd43dc 100644 --- a/.swiftlint.yml +++ b/.swiftlint.yml @@ -60,6 +60,9 @@ only_rules: # Lines should not have trailing whitespace. - trailing_whitespace + # Unused parameters in closures should be replaced with `_`. + - unused_closure_parameter + - custom_rules # Rules configuration diff --git a/Sources/Experiments/ExPlatService.swift b/Sources/Experiments/ExPlatService.swift index 2e65c8a5..6da31b05 100644 --- a/Sources/Experiments/ExPlatService.swift +++ b/Sources/Experiments/ExPlatService.swift @@ -70,7 +70,7 @@ public class ExPlatService { request.setValue(userAgent, forHTTPHeaderField: "User-Agent") } - let task = URLSession.shared.dataTask(with: request) { data, response, error in + let task = URLSession.shared.dataTask(with: request) { data, _, error in guard let data, error == nil else { completion(nil) return diff --git a/Tests/Tests/Event Logging/EventLoggingTests.swift b/Tests/Tests/Event Logging/EventLoggingTests.swift index f6e96998..8d22bf88 100644 --- a/Tests/Tests/Event Logging/EventLoggingTests.swift +++ b/Tests/Tests/Event Logging/EventLoggingTests.swift @@ -23,11 +23,11 @@ class EventLoggingTests: XCTestCase { exp.expectedFulfillmentCount = uploadCount let eventLogging = self.eventLogging(delegate: MockEventLoggingDelegate() - .withDidStartUploadingCallback { log in + .withDidStartUploadingCallback { _ in XCTAssertFalse(isUploading, "Only one upload should be running at the same time") isUploading = true } - .withDidFinishUploadingCallback { log in + .withDidFinishUploadingCallback { _ in XCTAssertTrue(isUploading, "Only one upload should be running at the same time") isUploading = false exp.fulfill() diff --git a/Tests/Tests/Event Logging/EventLoggingUploadManagerTests.swift b/Tests/Tests/Event Logging/EventLoggingUploadManagerTests.swift index 31e318a2..d02f8f30 100644 --- a/Tests/Tests/Event Logging/EventLoggingUploadManagerTests.swift +++ b/Tests/Tests/Event Logging/EventLoggingUploadManagerTests.swift @@ -61,7 +61,7 @@ class EventLoggingUploadManagerTests: XCTestCase { let delegate = MockEventLoggingDelegate() .withShouldUploadLogFilesValue(false) - .withUploadCancelledCallback { logFile in + .withUploadCancelledCallback { _ in exp.fulfill() } @@ -87,7 +87,7 @@ class EventLoggingUploadManagerTests: XCTestCase { exp.expectedFulfillmentCount = 2 let delegate = MockEventLoggingDelegate() - .withUploadFailedCallback { error, _ in + .withUploadFailedCallback { _, _ in exp.fulfill() } diff --git a/Tests/Tests/TracksEventPersistenceServiceTests.swift b/Tests/Tests/TracksEventPersistenceServiceTests.swift index 5baee02c..fc7e4c2b 100644 --- a/Tests/Tests/TracksEventPersistenceServiceTests.swift +++ b/Tests/Tests/TracksEventPersistenceServiceTests.swift @@ -81,7 +81,7 @@ class TracksEventPersistenceServiceTests: XCTestCase { let context = contextManager.managedObjectContext let service = TracksEventPersistenceService(managedObjectContext: context) - let uuids = (0 ..< 2002).map { index in + let uuids = (0 ..< 2002).map { _ in UUID() } @@ -164,7 +164,7 @@ class TracksEventPersistenceServiceTests: XCTestCase { let context = contextManager.managedObjectContext let service = TracksEventPersistenceService(managedObjectContext: context) - let uuids = (0 ..< 2002).map { index in + let uuids = (0 ..< 2002).map { _ in UUID() }