Skip to content

Commit

Permalink
Update formatting & linting dependencies (#134)
Browse files Browse the repository at this point in the history
* swiftlint to 0.57.0
* swift format to 0.54.6
* Apple swift format to 600.0.0
  • Loading branch information
fboemer authored Nov 12, 2024
1 parent b73daac commit 1edf5dd
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 7 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion Sources/HomomorphicEncryption/Keys.swift
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ public struct EvaluationKeyConfig: Codable, Equatable, Hashable, Sendable {
}

extension Sequence<EvaluationKeyConfig> {
/// 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
Expand Down
3 changes: 3 additions & 0 deletions Sources/PIRProcessDatabase/ProcessDatabase.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down Expand Up @@ -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)
}

Expand Down Expand Up @@ -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: "")
}
Expand Down
3 changes: 3 additions & 0 deletions Sources/PNNSProcessDatabase/ProcessDatabase.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down Expand Up @@ -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)
}

Expand Down Expand Up @@ -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: "")
}
Expand Down
2 changes: 2 additions & 0 deletions Sources/PrivateInformationRetrieval/Util.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 1edf5dd

Please sign in to comment.