Skip to content

Commit c1007b9

Browse files
Prachi Gauriarprachigauriar
authored andcommitted
Fix lint warnings in Xcode 26.4 RC1
1 parent 9dea13f commit c1007b9

File tree

16 files changed

+72
-59
lines changed

16 files changed

+72
-59
lines changed

Scripts/format

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/bash
2+
3+
# Get the directory where this script is located
4+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
5+
6+
# Go to the repository root (one level up from Scripts)
7+
REPO_ROOT="$(dirname "$SCRIPT_DIR")"
8+
9+
# Run swift format with --in-place to fix formatting issues
10+
swift format --in-place --recursive \
11+
"$REPO_ROOT/Packages/" \
12+
"$REPO_ROOT/Sources/" \
13+
"$REPO_ROOT/Tests/"

Sources/DevTesting/Collection Generation/CollectionGeneration.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ extension Array {
1515
/// - elementGenerator: A closure that generates array elements.
1616
public init<ErrorType>(
1717
count: Int,
18-
elementGenerator: () throws(ErrorType) -> Element
18+
elementGenerator: () throws(ErrorType) -> Element,
1919
) throws(ErrorType) where ErrorType: Error {
2020
try self.init(count: count) { (_) throws(ErrorType) in
2121
try elementGenerator()
@@ -31,7 +31,7 @@ extension Array {
3131
/// generated.
3232
public init<ErrorType>(
3333
count: Int,
34-
elementGenerator: (Int) throws(ErrorType) -> Element
34+
elementGenerator: (Int) throws(ErrorType) -> Element,
3535
) throws(ErrorType) where ErrorType: Error {
3636
self.init()
3737
reserveCapacity(count)
@@ -56,7 +56,7 @@ extension Dictionary {
5656
/// - keyPairGenerator: A closure that generates key-value pairs.
5757
public init<ErrorType>(
5858
count: Int,
59-
keyPairGenerator: () throws(ErrorType) -> (Key, Value)
59+
keyPairGenerator: () throws(ErrorType) -> (Key, Value),
6060
) throws(ErrorType) where ErrorType: Error {
6161
self.init(minimumCapacity: count)
6262

@@ -79,7 +79,7 @@ extension Set {
7979
/// - elementGenerator: A closure that generates set elements.
8080
public init<ErrorType>(
8181
count: Int,
82-
elementGenerator: () throws(ErrorType) -> Element
82+
elementGenerator: () throws(ErrorType) -> Element,
8383
) throws(ErrorType) where ErrorType: Error {
8484
self.init(minimumCapacity: count)
8585

Sources/DevTesting/Random Value Generation/BinaryFloatingPoint+Random.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ extension BinaryFloatingPoint where RawSignificand: FixedWidthInteger {
2222
/// - generator: The random number generator to use when creating the new random value.
2323
public static func randomPrintable(
2424
in range: Range<Self>,
25-
using generator: inout some RandomNumberGenerator
25+
using generator: inout some RandomNumberGenerator,
2626
) -> Self {
2727
let subdivisions = 256
2828

@@ -49,7 +49,7 @@ extension BinaryFloatingPoint where RawSignificand: FixedWidthInteger {
4949
/// - generator: The random number generator to use when creating the new random value.
5050
public static func randomPrintable(
5151
in range: ClosedRange<Self>,
52-
using generator: inout some RandomNumberGenerator
52+
using generator: inout some RandomNumberGenerator,
5353
) -> Self {
5454
let subdivisions = 256
5555

Sources/DevTesting/Random Value Generation/Date+Random.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,14 @@ extension Date {
1616
/// - Returns: A random date within the bounds of range.
1717
public static func random(
1818
in range: Range<Date>,
19-
using generator: inout some RandomNumberGenerator
19+
using generator: inout some RandomNumberGenerator,
2020
) -> Date {
2121
let lowerBound = range.lowerBound.timeIntervalSinceReferenceDate
2222
let upperBound = range.upperBound.timeIntervalSinceReferenceDate
2323
return Date(
2424
timeIntervalSinceReferenceDate: .randomPrintable(
2525
in: lowerBound ..< upperBound,
26-
using: &generator
26+
using: &generator,
2727
)
2828
)
2929
}
@@ -37,14 +37,14 @@ extension Date {
3737
/// - Returns: A random date within the bounds of range.
3838
public static func random(
3939
in range: ClosedRange<Date>,
40-
using generator: inout some RandomNumberGenerator
40+
using generator: inout some RandomNumberGenerator,
4141
) -> Date {
4242
let lowerBound = range.lowerBound.timeIntervalSinceReferenceDate
4343
let upperBound = range.upperBound.timeIntervalSinceReferenceDate
4444
return Date(
4545
timeIntervalSinceReferenceDate: .randomPrintable(
4646
in: lowerBound ... upperBound,
47-
using: &generator
47+
using: &generator,
4848
)
4949
)
5050
}

Sources/DevTesting/Random Value Generation/Optional+Random.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ extension Optional {
1616
/// - generator: The random number generator to use when creating the new random optional.
1717
public static func random(
1818
_ value: @autoclosure () -> Wrapped,
19-
using generator: inout some RandomNumberGenerator
19+
using generator: inout some RandomNumberGenerator,
2020
) -> Self {
2121
return Bool.random(using: &generator) ? value() : nil
2222
}

Sources/DevTesting/Random Value Generation/RandomValueGenerating.swift

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ extension RandomValueGenerating {
151151
public mutating func randomData(count: Int? = nil) -> Data {
152152
return Data.random(
153153
count: count ?? randomInt(in: 16 ... 128),
154-
using: &randomNumberGenerator
154+
using: &randomNumberGenerator,
155155
)
156156
}
157157

@@ -191,7 +191,7 @@ extension RandomValueGenerating {
191191
/// - range: The half-open range in which to create a random value.
192192
public mutating func random<FloatingPoint>(
193193
_ type: FloatingPoint.Type,
194-
in range: Range<FloatingPoint>
194+
in range: Range<FloatingPoint>,
195195
) -> FloatingPoint
196196
where FloatingPoint: BinaryFloatingPoint, FloatingPoint.RawSignificand: FixedWidthInteger {
197197
return FloatingPoint.randomPrintable(in: range, using: &randomNumberGenerator)
@@ -217,7 +217,7 @@ extension RandomValueGenerating {
217217
/// - range: The closed range in which to create a random value.
218218
public mutating func random<FloatingPoint>(
219219
_ type: FloatingPoint.Type,
220-
in range: ClosedRange<FloatingPoint>
220+
in range: ClosedRange<FloatingPoint>,
221221
) -> FloatingPoint
222222
where FloatingPoint: BinaryFloatingPoint, FloatingPoint.RawSignificand: FixedWidthInteger {
223223
return FloatingPoint.randomPrintable(in: range, using: &randomNumberGenerator)
@@ -243,7 +243,7 @@ extension RandomValueGenerating {
243243
/// - range: The half-open range in which to create a random value.
244244
public mutating func random<Integer>(
245245
_ type: Integer.Type,
246-
in range: Range<Integer>
246+
in range: Range<Integer>,
247247
) -> Integer
248248
where Integer: FixedWidthInteger {
249249
return Integer.random(in: range, using: &randomNumberGenerator)
@@ -269,7 +269,7 @@ extension RandomValueGenerating {
269269
/// - range: The closed range in which to create a random value.
270270
public mutating func random<Integer>(
271271
_ type: Integer.Type,
272-
in range: ClosedRange<Integer>
272+
in range: ClosedRange<Integer>,
273273
) -> Integer
274274
where Integer: FixedWidthInteger {
275275
return Integer.random(in: range, using: &randomNumberGenerator)
@@ -310,7 +310,7 @@ extension RandomValueGenerating {
310310
public mutating func randomAlphanumericString(count: Int? = nil) -> String {
311311
return String.randomAlphanumeric(
312312
count: count ?? Int.random(in: 5 ... 10, using: &randomNumberGenerator),
313-
using: &randomNumberGenerator
313+
using: &randomNumberGenerator,
314314
)
315315
}
316316

@@ -324,7 +324,7 @@ extension RandomValueGenerating {
324324
public mutating func randomBasicLatinString(count: Int? = nil) -> String {
325325
return String.randomBasicLatin(
326326
count: count ?? Int.random(in: 5 ... 10, using: &randomNumberGenerator),
327-
using: &randomNumberGenerator
327+
using: &randomNumberGenerator,
328328
)
329329
}
330330

@@ -339,12 +339,12 @@ extension RandomValueGenerating {
339339
/// chosen.
340340
public mutating func randomString(
341341
withCharactersFrom characters: some Collection<Character>,
342-
count: Int? = nil
342+
count: Int? = nil,
343343
) -> String {
344344
return String.random(
345345
withCharactersFrom: characters,
346346
count: count ?? Int.random(in: 5 ... 10, using: &randomNumberGenerator),
347-
using: &randomNumberGenerator
347+
using: &randomNumberGenerator,
348348
)
349349
}
350350

@@ -370,12 +370,12 @@ extension RandomValueGenerating {
370370
/// include query items or not.
371371
public mutating func randomURL(
372372
includeFragment: Bool? = nil,
373-
includeQueryItems: Bool? = nil
373+
includeQueryItems: Bool? = nil,
374374
) -> URL {
375375
return URL.random(
376376
includeFragment: includeFragment,
377377
includeQueryItems: includeQueryItems,
378-
using: &randomNumberGenerator
378+
using: &randomNumberGenerator,
379379
)
380380
}
381381

@@ -391,12 +391,12 @@ extension RandomValueGenerating {
391391
/// include query items or not.
392392
public mutating func randomURLComponents(
393393
includeFragment: Bool? = nil,
394-
includeQueryItems: Bool? = nil
394+
includeQueryItems: Bool? = nil,
395395
) -> URLComponents {
396396
return URLComponents.random(
397397
includeFragment: includeFragment,
398398
includeQueryItems: includeQueryItems,
399-
using: &randomNumberGenerator
399+
using: &randomNumberGenerator,
400400
)
401401
}
402402

Sources/DevTesting/Random Value Generation/String+Random.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ extension String {
1818
public static func random(
1919
withCharactersFrom characters: some Collection<Character>,
2020
count: Int,
21-
using generator: inout some RandomNumberGenerator
21+
using generator: inout some RandomNumberGenerator,
2222
) -> String {
2323
precondition(!characters.isEmpty || count == 0, "count must be 0 if characters is empty")
2424
guard count > 0 else {
@@ -39,14 +39,14 @@ extension String {
3939
/// - generator: The random number generator to use when creating the new random string.
4040
public static func randomAlphanumeric(
4141
count: Int,
42-
using generator: inout some RandomNumberGenerator
42+
using generator: inout some RandomNumberGenerator,
4343
) -> String {
4444
return random(
4545
withCharactersFrom: characters(
46-
fromUnicodeScalarRanges: 0x30 ... 0x39, 0x41 ... 0x5a, 0x61 ... 0x7a
46+
fromUnicodeScalarRanges: 0x30 ... 0x39, 0x41 ... 0x5a, 0x61 ... 0x7a,
4747
),
4848
count: count,
49-
using: &generator
49+
using: &generator,
5050
)
5151
}
5252

@@ -65,12 +65,12 @@ extension String {
6565
/// - generator: The random number generator to use when creating the new random string.
6666
public static func randomBasicLatin(
6767
count: Int,
68-
using generator: inout some RandomNumberGenerator
68+
using generator: inout some RandomNumberGenerator,
6969
) -> String {
7070
return random(
7171
withCharactersFrom: characters(fromUnicodeScalarRanges: 0x20 ... 0x7e),
7272
count: count,
73-
using: &generator
73+
using: &generator,
7474
)
7575
}
7676

Sources/DevTesting/Random Value Generation/URL+Random.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@ extension URL {
2222
public static func random(
2323
includeFragment: Bool? = nil,
2424
includeQueryItems: Bool? = nil,
25-
using generator: inout some RandomNumberGenerator
25+
using generator: inout some RandomNumberGenerator,
2626
) -> URL {
2727
return URLComponents.random(
2828
includeFragment: includeFragment,
2929
includeQueryItems: includeQueryItems,
30-
using: &generator
30+
using: &generator,
3131
).url!
3232
}
3333
}

Sources/DevTesting/Random Value Generation/URLComponents+Random.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ extension URLComponents {
3030
public static func random(
3131
includeFragment: Bool? = nil,
3232
includeQueryItems: Bool? = nil,
33-
using generator: inout some RandomNumberGenerator
33+
using generator: inout some RandomNumberGenerator,
3434
) -> URLComponents {
3535
var urlComponents = URLComponents()
3636

@@ -47,7 +47,7 @@ extension URLComponents {
4747
let pathComponents = Array(count: Int.random(in: 1 ... 5, using: &generator)) {
4848
String.randomAlphanumeric(
4949
count: Int.random(in: 1 ... 5, using: &generator),
50-
using: &generator
50+
using: &generator,
5151
)
5252
}
5353
urlComponents.path = "/\(pathComponents.joined(separator: "/"))"
@@ -56,7 +56,7 @@ extension URLComponents {
5656
if includeFragment ?? Bool.random(using: &generator) {
5757
urlComponents.fragment = String.randomAlphanumeric(
5858
count: Int.random(in: 3 ... 5, using: &generator),
59-
using: &generator
59+
using: &generator,
6060
)
6161
}
6262

Sources/DevTesting/Random Value Generation/URLQueryItem+Random.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,14 @@ extension URLQueryItem {
1818
return URLQueryItem(
1919
name: .randomAlphanumeric(
2020
count: Int.random(in: 3 ... 10, using: &generator),
21-
using: &generator
21+
using: &generator,
2222
),
2323
value: Int.random(in: 0 ..< 10, using: &generator) == 0
2424
? nil
2525
: .randomAlphanumeric(
2626
count: Int.random(in: 3 ... 10, using: &generator),
27-
using: &generator
28-
)
27+
using: &generator,
28+
),
2929
)
3030
}
3131
}

0 commit comments

Comments
 (0)