Skip to content

Commit 96c32fa

Browse files
committed
workflows: Allow swift-format to fix whitespace
1 parent 164d34a commit 96c32fa

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+757
-562
lines changed

Package.swift

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ let package = Package(
1111
.executable(
1212
name: "swift-sdk-generator",
1313
targets: ["GeneratorCLI"]
14-
),
14+
)
1515
],
1616
targets: [
1717
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
@@ -23,7 +23,7 @@ let package = Package(
2323
.product(name: "ArgumentParser", package: "swift-argument-parser"),
2424
],
2525
swiftSettings: [
26-
.enableExperimentalFeature("StrictConcurrency=complete"),
26+
.enableExperimentalFeature("StrictConcurrency=complete")
2727
]
2828
),
2929
.target(
@@ -38,22 +38,22 @@ let package = Package(
3838
],
3939
exclude: ["Dockerfiles"],
4040
swiftSettings: [
41-
.enableExperimentalFeature("StrictConcurrency=complete"),
41+
.enableExperimentalFeature("StrictConcurrency=complete")
4242
]
4343
),
4444
.testTarget(
4545
name: "SwiftSDKGeneratorTests",
4646
dependencies: [
47-
"SwiftSDKGenerator",
47+
"SwiftSDKGenerator"
4848
],
4949
swiftSettings: [
50-
.enableExperimentalFeature("StrictConcurrency=complete"),
50+
.enableExperimentalFeature("StrictConcurrency=complete")
5151
]
5252
),
5353
.testTarget(
5454
name: "GeneratorEngineTests",
5555
dependencies: [
56-
"Helpers",
56+
"Helpers"
5757
]
5858
),
5959
.target(
@@ -66,13 +66,13 @@ let package = Package(
6666
],
6767
exclude: ["Vendor/README.md"],
6868
swiftSettings: [
69-
.enableExperimentalFeature("StrictConcurrency=complete"),
69+
.enableExperimentalFeature("StrictConcurrency=complete")
7070
]
7171
),
7272
.testTarget(
7373
name: "HelpersTests",
7474
dependencies: [
75-
"Helpers",
75+
"Helpers"
7676
]
7777
),
7878
.systemLibrary(name: "SystemSQLite", pkgConfig: "sqlite3"),

Sources/AsyncProcess/ChunkSequence.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313
import NIO
1414

1515
#if os(Linux) || os(Android) || os(Windows)
16-
@preconcurrency import Foundation
16+
@preconcurrency import Foundation
1717
#else
18-
import Foundation
18+
import Foundation
1919
#endif
2020

2121
public struct IllegalStreamConsumptionError: Error {
@@ -53,9 +53,9 @@ public struct ChunkSequence: AsyncSequence & Sendable {
5353
} else {
5454
throw IllegalStreamConsumptionError(
5555
description: """
56-
Either `.discard`ed, `.inherit`ed or redirected this stream to a `.fileHandle`,
57-
cannot also consume it. To consume, please `.stream` it.
58-
"""
56+
Either `.discard`ed, `.inherit`ed or redirected this stream to a `.fileHandle`,
57+
cannot also consume it. To consume, please `.stream` it.
58+
"""
5959
)
6060
}
6161
}

Sources/AsyncProcess/FileContentStream.swift

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,8 @@ private final class ReadIntoAsyncChannelHandler: ChannelDuplexHandler {
255255

256256
extension FileHandle {
257257
func fileContentStream(eventLoop: EventLoop) throws -> FileContentStream {
258-
let asyncBytes = try FileContentStream(fileDescriptor: self.fileDescriptor, eventLoop: eventLoop)
258+
let asyncBytes = try FileContentStream(
259+
fileDescriptor: self.fileDescriptor, eventLoop: eventLoop)
259260
try self.close()
260261
return asyncBytes
261262
}
@@ -272,8 +273,8 @@ extension FileContentStream {
272273
}
273274
}
274275

275-
public extension AsyncSequence where Element == ByteBuffer, Self: Sendable {
276-
func splitIntoLines(
276+
extension AsyncSequence where Element == ByteBuffer, Self: Sendable {
277+
public func splitIntoLines(
277278
dropTerminator: Bool = true,
278279
maximumAllowableBufferSize: Int = 1024 * 1024,
279280
dropLastChunkIfNoNewline: Bool = false
@@ -286,14 +287,13 @@ public extension AsyncSequence where Element == ByteBuffer, Self: Sendable {
286287
)
287288
}
288289

289-
var strings: AsyncMapSequence<Self, String> {
290+
public var strings: AsyncMapSequence<Self, String> {
290291
self.map { String(buffer: $0) }
291292
}
292293
}
293294

294295
public struct AsyncByteBufferLineSequence<Base: Sendable>: AsyncSequence & Sendable
295-
where Base: AsyncSequence, Base.Element == ByteBuffer
296-
{
296+
where Base: AsyncSequence, Base.Element == ByteBuffer {
297297
public typealias Element = ByteBuffer
298298
private let underlying: Base
299299
private let dropTerminator: Bool
@@ -329,7 +329,9 @@ public struct AsyncByteBufferLineSequence<Base: Sendable>: AsyncSequence & Senda
329329
self.buffer.last?.readableBytesView
330330
}
331331

332-
mutating func concatenateEverything(upToLastChunkLengthToConsume lastLength: Int) -> ByteBuffer {
332+
mutating func concatenateEverything(upToLastChunkLengthToConsume lastLength: Int)
333+
-> ByteBuffer
334+
{
333335
var output = ByteBuffer()
334336
output.reserveCapacity(lastLength + self.byteCountButLast)
335337

Sources/AsyncProcess/ProcessExecutor+Convenience.swift

Lines changed: 25 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public struct OutputLoggingSettings: Sendable {
5353
}
5454
}
5555

56-
public extension ProcessExecutor {
56+
extension ProcessExecutor {
5757
/// Run child process, discarding all its output.
5858
///
5959
/// - note: The `environment` defaults to the empty environment.
@@ -69,7 +69,7 @@ public extension ProcessExecutor {
6969
/// don't want to
7070
/// provide input.
7171
/// - logger: Where to log diagnostic messages to (default to no where)
72-
static func run<StandardInput: AsyncSequence & Sendable>(
72+
public static func run<StandardInput: AsyncSequence & Sendable>(
7373
group: EventLoopGroup = ProcessExecutor.defaultEventLoopGroup,
7474
executable: String,
7575
_ arguments: [String],
@@ -106,7 +106,7 @@ public extension ProcessExecutor {
106106
/// provide input.
107107
/// - logger: Where to log diagnostic and output messages to
108108
/// - logConfiguration: How to log the output lines
109-
static func runLogOutput<StandardInput: AsyncSequence & Sendable>(
109+
public static func runLogOutput<StandardInput: AsyncSequence & Sendable>(
110110
group: EventLoopGroup = ProcessExecutor.defaultEventLoopGroup,
111111
executable: String,
112112
_ arguments: [String],
@@ -128,7 +128,9 @@ public extension ProcessExecutor {
128128
return try await withThrowingTaskGroup(of: ProcessExitReason?.self) { group in
129129
group.addTask {
130130
for try await (stream, line) in await merge(
131-
exe.standardOutput.splitIntoLines().strings.map { (ProcessOutputStream.standardOutput, $0) },
131+
exe.standardOutput.splitIntoLines().strings.map {
132+
(ProcessOutputStream.standardOutput, $0)
133+
},
132134
exe.standardError.splitIntoLines().strings.map { (ProcessOutputStream.standardError, $0) }
133135
) {
134136
logger.log(
@@ -171,12 +173,12 @@ public extension ProcessExecutor {
171173
/// - splitOutputIntoLines: Whether to call the closure with full lines (`true`) or arbitrary chunks of output
172174
/// (`false`)
173175
/// - logger: Where to log diagnostic and output messages to
174-
static func runProcessingOutput<StandardInput: AsyncSequence & Sendable>(
176+
public static func runProcessingOutput<StandardInput: AsyncSequence & Sendable>(
175177
group: EventLoopGroup = ProcessExecutor.defaultEventLoopGroup,
176178
executable: String,
177179
_ arguments: [String],
178180
standardInput: StandardInput,
179-
outputProcessor: @escaping @Sendable (ProcessOutputStream, ByteBuffer) async throws -> (),
181+
outputProcessor: @escaping @Sendable (ProcessOutputStream, ByteBuffer) async throws -> Void,
180182
splitOutputIntoLines: Bool = false,
181183
environment: [String: String] = [:],
182184
logger: Logger = ProcessExecutor.disableLogging
@@ -225,11 +227,11 @@ public extension ProcessExecutor {
225227
}
226228
}
227229

228-
struct TooMuchProcessOutputError: Error, Sendable & Hashable {
230+
public struct TooMuchProcessOutputError: Error, Sendable & Hashable {
229231
public var stream: ProcessOutputStream
230232
}
231233

232-
struct ProcessExitReasonAndOutput: Sendable & Hashable {
234+
public struct ProcessExitReasonAndOutput: Sendable & Hashable {
233235
public var exitReason: ProcessExitReason
234236
public var standardOutput: ByteBuffer?
235237
public var standardError: ByteBuffer?
@@ -260,7 +262,7 @@ public extension ProcessExecutor {
260262
/// - collectStandardError: If `true`, collect all of the child process' standard error into memory, discard if
261263
/// `false`
262264
/// - logger: Where to log diagnostic and output messages to
263-
static func runCollectingOutput<StandardInput: AsyncSequence & Sendable>(
265+
public static func runCollectingOutput<StandardInput: AsyncSequence & Sendable>(
264266
group: EventLoopGroup = ProcessExecutor.defaultEventLoopGroup,
265267
executable: String,
266268
_ arguments: [String],
@@ -287,7 +289,9 @@ public extension ProcessExecutor {
287289
if collectStandardOutput {
288290
var output: ByteBuffer? = nil
289291
for try await chunk in await exe.standardOutput {
290-
guard (output?.readableBytes ?? 0) + chunk.readableBytes <= perStreamCollectionLimitBytes else {
292+
guard
293+
(output?.readableBytes ?? 0) + chunk.readableBytes <= perStreamCollectionLimitBytes
294+
else {
291295
throw TooMuchProcessOutputError(stream: .standardOutput)
292296
}
293297
output.setOrWriteImmutableBuffer(chunk)
@@ -302,7 +306,9 @@ public extension ProcessExecutor {
302306
if collectStandardError {
303307
var output: ByteBuffer? = nil
304308
for try await chunk in await exe.standardError {
305-
guard (output?.readableBytes ?? 0) + chunk.readableBytes <= perStreamCollectionLimitBytes else {
309+
guard
310+
(output?.readableBytes ?? 0) + chunk.readableBytes <= perStreamCollectionLimitBytes
311+
else {
306312
throw TooMuchProcessOutputError(stream: .standardError)
307313
}
308314
output.setOrWriteImmutableBuffer(chunk)
@@ -317,7 +323,8 @@ public extension ProcessExecutor {
317323
try await .exitReason(exe.run())
318324
}
319325

320-
var allInfo = ProcessExitReasonAndOutput(exitReason: .exit(-1), standardOutput: nil, standardError: nil)
326+
var allInfo = ProcessExitReasonAndOutput(
327+
exitReason: .exit(-1), standardOutput: nil, standardError: nil)
321328
while let next = try await group.next() {
322329
switch next {
323330
case let .exitReason(exitReason):
@@ -333,7 +340,7 @@ public extension ProcessExecutor {
333340
}
334341
}
335342

336-
public extension ProcessExecutor {
343+
extension ProcessExecutor {
337344
/// Run child process, discarding all its output.
338345
///
339346
/// - note: The `environment` defaults to the empty environment.
@@ -346,7 +353,7 @@ public extension ProcessExecutor {
346353
/// If you want to inherit the calling process' environment into the child, specify
347354
/// `ProcessInfo.processInfo.environment`
348355
/// - logger: Where to log diagnostic messages to (default to no where)
349-
static func run(
356+
public static func run(
350357
group: EventLoopGroup = ProcessExecutor.defaultEventLoopGroup,
351358
executable: String,
352359
_ arguments: [String],
@@ -376,7 +383,7 @@ public extension ProcessExecutor {
376383
/// `ProcessInfo.processInfo.environment`
377384
/// - logger: Where to log diagnostic and output messages to
378385
/// - logConfiguration: How to log the output lines
379-
static func runLogOutput(
386+
public static func runLogOutput(
380387
group: EventLoopGroup = ProcessExecutor.defaultEventLoopGroup,
381388
executable: String,
382389
_ arguments: [String],
@@ -410,11 +417,11 @@ public extension ProcessExecutor {
410417
/// - splitOutputIntoLines: Whether to call the closure with full lines (`true`) or arbitrary chunks of output
411418
/// (`false`)
412419
/// - logger: Where to log diagnostic and output messages to
413-
static func runProcessingOutput(
420+
public static func runProcessingOutput(
414421
group: EventLoopGroup = ProcessExecutor.defaultEventLoopGroup,
415422
executable: String,
416423
_ arguments: [String],
417-
outputProcessor: @escaping @Sendable (ProcessOutputStream, ByteBuffer) async throws -> (),
424+
outputProcessor: @escaping @Sendable (ProcessOutputStream, ByteBuffer) async throws -> Void,
418425
splitOutputIntoLines: Bool = false,
419426
environment: [String: String] = [:],
420427
logger: Logger = ProcessExecutor.disableLogging
@@ -447,7 +454,7 @@ public extension ProcessExecutor {
447454
/// - collectStandardError: If `true`, collect all of the child process' standard error into memory, discard if
448455
/// `false`
449456
/// - logger: Where to log diagnostic and output messages to
450-
static func runCollectingOutput(
457+
public static func runCollectingOutput(
451458
group: EventLoopGroup = ProcessExecutor.defaultEventLoopGroup,
452459
executable: String,
453460
_ arguments: [String],

0 commit comments

Comments
 (0)