Fix remaining compilation warnings

- Remove unnecessary nil check for non-optional URL in PathSplittingTests
- Add CodingKeys enum to ServerEvent to explicitly exclude auto-generated id property from encoding/decoding

This resolves all compilation warnings except the harmless AppIntents metadata warning.
This commit is contained in:
Peter Steinberger 2025-07-27 16:33:44 +02:00
parent cfdfe70083
commit 22bcdeffd4
2 changed files with 16 additions and 2 deletions

View file

@ -363,4 +363,19 @@ struct ServerEvent: Codable, Identifiable, Equatable {
formatter.timeStyle = .medium
return formatter.string(from: timestamp)
}
// MARK: - Codable
/// Coding keys to exclude `id` from encoding/decoding since it's auto-generated
enum CodingKeys: String, CodingKey {
case type
case sessionId
case sessionName
case command
case exitCode
case duration
case processInfo
case message
case timestamp
}
}

View file

@ -25,8 +25,7 @@ struct PathSplittingTests {
let fileManager = FileManager.default
let exists = fileManager.fileExists(atPath: nonExistentPath)
// URL is still created even for non-existent paths
#expect(url != nil)
// URL is always created for any path (even non-existent ones)
#expect(url.path == nonExistentPath)
#expect(!exists)
}