From 1edf5ddadc37d4a7b2a67e47d5613b9c95166626 Mon Sep 17 00:00:00 2001 From: Fabian Boemer Date: Tue, 12 Nov 2024 11:22:29 -0800 Subject: [PATCH] Update formatting & linting dependencies (#134) * swiftlint to 0.57.0 * swift format to 0.54.6 * Apple swift format to 600.0.0 --- .github/workflows/ci.yml | 4 ++-- README.md | 8 ++++---- Sources/HomomorphicEncryption/Keys.swift | 2 +- Sources/PIRProcessDatabase/ProcessDatabase.swift | 3 +++ Sources/PNNSProcessDatabase/ProcessDatabase.swift | 3 +++ Sources/PrivateInformationRetrieval/Util.swift | 2 ++ 6 files changed, 15 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6165aaf7..cd688679 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -28,8 +28,8 @@ concurrency: cancel-in-progress: true # Keep versions in sync with README env: - SWIFTLINT_VERSION: 0.55.1 - SWIFTFORMAT_VERSION: 0.54.0 + SWIFTLINT_VERSION: 0.57.0 + SWIFTFORMAT_VERSION: 0.54.6 jobs: swift-tests: timeout-minutes: 15 diff --git a/README.md b/README.md index ddadafdd..6edc95dd 100644 --- a/README.md +++ b/README.md @@ -150,11 +150,11 @@ We'd like this package to quickly embrace Swift language and toolchain improveme ## Developing Swift Homomorphic Encryption ### Dependencies Developing Swift Homomorphic Encryption requires: -* [Nick Lockwood SwiftFormat](https://github.com/nicklockwood/SwiftFormat), v0.54.0 +* [Nick Lockwood SwiftFormat](https://github.com/nicklockwood/SwiftFormat), 0.54.6 * [pre-commit](https://pre-commit.com) -* [swift-format](https://github.com/apple/swift-format), v510.1.0 -* [swift-protobuf](https://github.com/apple/swift-protobuf), v1.28.1 -* [SwiftLint](https://github.com/realm/SwiftLint), v0.55.1 +* [swift-format](https://github.com/swiftlang/swift-format), 600.0.0 +* [swift-protobuf](https://github.com/apple/swift-protobuf), 1.28.1 +* [SwiftLint](https://github.com/realm/SwiftLint), 0.57.0 ### Building You can build Swift Homomorphic Encryption either via Xcode or via command line in a terminal. diff --git a/Sources/HomomorphicEncryption/Keys.swift b/Sources/HomomorphicEncryption/Keys.swift index d164d636..0c2a85f2 100644 --- a/Sources/HomomorphicEncryption/Keys.swift +++ b/Sources/HomomorphicEncryption/Keys.swift @@ -169,7 +169,7 @@ public struct EvaluationKeyConfig: Codable, Equatable, Hashable, Sendable { } extension Sequence { - /// Computes the union of ``EvaluationKeyConfig``s. + /// Computes the union of evaluation key configurations. /// /// The union of ``EvaluationKeyConfig``s is a configuration whose: /// * Galois elements is a union of each configuration's Galois elements diff --git a/Sources/PIRProcessDatabase/ProcessDatabase.swift b/Sources/PIRProcessDatabase/ProcessDatabase.swift index 96aab23f..0eec76bc 100644 --- a/Sources/PIRProcessDatabase/ProcessDatabase.swift +++ b/Sources/PIRProcessDatabase/ProcessDatabase.swift @@ -168,6 +168,7 @@ struct Arguments: Codable, Equatable, Hashable, Sendable { encoder.outputFormatting = [.prettyPrinted, .sortedKeys, .withoutEscapingSlashes] // swiftlint:disable:next force_try let data = try! encoder.encode(defaultArguments) + // swiftlint:disable:next optional_data_string_conversion return String(decoding: data, as: UTF8.self) } @@ -233,6 +234,7 @@ struct ResolvedArguments: CustomStringConvertible, Encodable { encoder.outputFormatting = [.prettyPrinted, .sortedKeys, .withoutEscapingSlashes] // swiftlint:disable:next force_try let data = try! encoder.encode(self) + // swiftlint:disable:next optional_data_string_conversion return String(decoding: data, as: UTF8.self) } @@ -494,6 +496,7 @@ extension ProcessKeywordDatabase.ShardValidationResult { encoder.outputFormatting = [.prettyPrinted, .sortedKeys, .withoutEscapingSlashes] // swiftlint:disable:next force_try let data = try! encoder.encode(descriptionDict) + // swiftlint:disable:next optional_data_string_conversion let description = String(decoding: data, as: UTF8.self) return description.replacingOccurrences(of: "\"", with: "") } diff --git a/Sources/PNNSProcessDatabase/ProcessDatabase.swift b/Sources/PNNSProcessDatabase/ProcessDatabase.swift index cd9e1458..d389d4a1 100644 --- a/Sources/PNNSProcessDatabase/ProcessDatabase.swift +++ b/Sources/PNNSProcessDatabase/ProcessDatabase.swift @@ -105,6 +105,7 @@ struct Arguments: Codable, Equatable, Hashable, Sendable { encoder.outputFormatting = [.prettyPrinted, .sortedKeys, .withoutEscapingSlashes] // swiftlint:disable:next force_try let data = try! encoder.encode(defaultArguments) + // swiftlint:disable:next optional_data_string_conversion return String(decoding: data, as: UTF8.self) } @@ -157,6 +158,7 @@ struct ResolvedArguments: CustomStringConvertible, Encodable { encoder.outputFormatting = [.prettyPrinted, .sortedKeys, .withoutEscapingSlashes] // swiftlint:disable:next force_try let data = try! encoder.encode(self) + // swiftlint:disable:next optional_data_string_conversion return String(decoding: data, as: UTF8.self) } @@ -321,6 +323,7 @@ extension ValidationResult { encoder.outputFormatting = [.prettyPrinted, .sortedKeys, .withoutEscapingSlashes] // swiftlint:disable:next force_try let data = try! encoder.encode(descriptionDict) + // swiftlint:disable:next optional_data_string_conversion let description = String(decoding: data, as: UTF8.self) return description.replacingOccurrences(of: "\"", with: "") } diff --git a/Sources/PrivateInformationRetrieval/Util.swift b/Sources/PrivateInformationRetrieval/Util.swift index d8eb7939..09affda8 100644 --- a/Sources/PrivateInformationRetrieval/Util.swift +++ b/Sources/PrivateInformationRetrieval/Util.swift @@ -16,6 +16,8 @@ import Foundation extension [UInt8] { func utf8OrBase64() -> String { + // swiftlint doesn't recognize the API + // swiftlint:disable:next optional_data_string_conversion if let utf8 = String(validating: self, as: UTF8.self) { "\(utf8) (utf8)" } else {