Skip to content

Commit 1e8b322

Browse files
committed
chore: Update swift-format rules.
1 parent e3af2d2 commit 1e8b322

File tree

10 files changed

+88
-11
lines changed

10 files changed

+88
-11
lines changed

.swift-format

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
{
2+
"fileScopedDeclarationPrivacy" : {
3+
"accessLevel" : "private"
4+
},
5+
"indentConditionalCompilationBlocks" : false,
6+
"indentSwitchCaseLabels" : false,
7+
"indentation" : {
8+
"spaces" : 4
9+
},
10+
"lineBreakAroundMultilineExpressionChainComponents" : false,
11+
"lineBreakBeforeControlFlowKeywords" : false,
12+
"lineBreakBeforeEachArgument" : false,
13+
"lineBreakBeforeEachGenericRequirement" : false,
14+
"lineBreakBetweenDeclarationAttributes" : false,
15+
"lineLength" : 140,
16+
"maximumBlankLines" : 1,
17+
"multiElementCollectionTrailingCommas" : true,
18+
"noAssignmentInExpressions" : {
19+
"allowedFunctions" : [
20+
"XCTAssertNoThrow"
21+
]
22+
},
23+
"prioritizeKeepingFunctionOutputTogether" : false,
24+
"reflowMultilineStringLiterals" : "never",
25+
"respectsExistingLineBreaks" : true,
26+
"rules" : {
27+
"AllPublicDeclarationsHaveDocumentation" : false,
28+
"AlwaysUseLiteralForEmptyCollectionInit" : false,
29+
"AlwaysUseLowerCamelCase" : true,
30+
"AmbiguousTrailingClosureOverload" : true,
31+
"AvoidRetroactiveConformances" : true,
32+
"BeginDocumentationCommentWithOneLineSummary" : false,
33+
"DoNotUseSemicolons" : true,
34+
"DontRepeatTypeInStaticProperties" : true,
35+
"FileScopedDeclarationPrivacy" : true,
36+
"FullyIndirectEnum" : true,
37+
"GroupNumericLiterals" : true,
38+
"IdentifiersMustBeASCII" : true,
39+
"NeverForceUnwrap" : false,
40+
"NeverUseForceTry" : false,
41+
"NeverUseImplicitlyUnwrappedOptionals" : false,
42+
"NoAccessLevelOnExtensionDeclaration" : true,
43+
"NoAssignmentInExpressions" : true,
44+
"NoBlockComments" : true,
45+
"NoCasesWithOnlyFallthrough" : true,
46+
"NoEmptyLinesOpeningClosingBraces" : false,
47+
"NoEmptyTrailingClosureParentheses" : true,
48+
"NoLabelsInCasePatterns" : true,
49+
"NoLeadingUnderscores" : false,
50+
"NoParensAroundConditions" : true,
51+
"NoPlaygroundLiterals" : true,
52+
"NoVoidReturnOnFunctionSignature" : true,
53+
"OmitExplicitReturns" : false,
54+
"OneCasePerLine" : true,
55+
"OneVariableDeclarationPerLine" : true,
56+
"OnlyOneTrailingClosureArgument" : true,
57+
"OrderedImports" : true,
58+
"ReplaceForEachWithForLoop" : true,
59+
"ReturnVoidInsteadOfEmptyTuple" : true,
60+
"TypeNamesShouldBeCapitalized" : true,
61+
"UseEarlyExits" : false,
62+
"UseExplicitNilCheckInConditions" : true,
63+
"UseLetInEveryBoundCaseVariable" : true,
64+
"UseShorthandTypeNames" : true,
65+
"UseSingleLinePropertyGetter" : true,
66+
"UseSynthesizedInitializer" : true,
67+
"UseTripleSlashForDocumentationComments" : true,
68+
"UseWhereClausesInForLoops" : false,
69+
"ValidateDocumentationComments" : false
70+
},
71+
"spacesAroundRangeFormationOperators" : true,
72+
"spacesBeforeEndOfLineComments" : 1,
73+
"tabWidth" : 8,
74+
"version" : 1
75+
}

Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ let package = Package(
77
products: [
88
.library(
99
name: "DispatchAsync",
10-
targets: ["DispatchAsync"]),
10+
targets: ["DispatchAsync"])
1111
],
1212
targets: [
1313
.target(

Sources/DispatchAsync/AsyncSemaphore.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
@available(macOS 10.15, *)
1818
actor AsyncSemaphore {
1919
private var value: Int
20-
private var waiters: Array<CheckedContinuation<Void, Never>> = []
20+
private var waiters: [CheckedContinuation<Void, Never>] = []
2121

2222
init(value: Int = 1) {
2323
self.value = value

Sources/DispatchAsync/DispatchSemaphore.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@
3737
/// Swift Concurrency api's with a safe async wait function.
3838
@available(
3939
*,
40-
deprecated,
41-
renamed: "AsyncSemaphore",
42-
message: "DispatchSemaphore.wait is dangerous because of it's thread-blocking nature. Use AsyncSemaphore and Swift Concurrency instead."
40+
deprecated,
41+
renamed: "AsyncSemaphore",
42+
message: "DispatchSemaphore.wait is dangerous because of it's thread-blocking nature. Use AsyncSemaphore and Swift Concurrency instead."
4343
)
4444
@available(macOS 10.15, *)
4545
public class DispatchSemaphore: @unchecked Sendable {

Sources/DispatchAsync/DispatchTimeInterval.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public enum DispatchTimeInterval: Equatable, Sendable {
4646
}
4747
}
4848

49-
public static func ==(lhs: DispatchTimeInterval, rhs: DispatchTimeInterval) -> Bool {
49+
public static func == (lhs: DispatchTimeInterval, rhs: DispatchTimeInterval) -> Bool {
5050
switch (lhs, rhs) {
5151
case (.never, .never): return true
5252
case (.never, _): return false

Sources/DispatchAsync/PackageConstants.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@
1212
//
1313
//===----------------------------------------------------------------------===//
1414

15-
package let kNanosecondsPerSecond: UInt64 = 1_000_000_000
15+
package let kNanosecondsPerSecond: UInt64 = 1_000_000_000
1616
package let kNanosecondsPerMillisecond: UInt64 = 1_000_000
1717
package let kNanoSecondsPerMicrosecond: UInt64 = 1_000

Tests/DispatchAsyncTests/DispatchGroupTests.swift

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
//===----------------------------------------------------------------------===//
1414

1515
import Testing
16+
1617
@testable import DispatchAsync
1718

1819
@Test
@@ -112,12 +113,10 @@ func dispatchGroupOrderCleanliness() async throws {
112113
// print(finalValue)
113114

114115
#expect(finalValue.prefix(1) == "|")
115-
#expect(finalValue.count { $0 == "🟣"} == 3)
116-
#expect(finalValue.count { $0 == "🟢"} == 1)
116+
#expect(finalValue.count { $0 == "🟣" } == 3)
117+
#expect(finalValue.count { $0 == "🟢" } == 1)
117118
#expect(finalValue.lastIndex(of: "🟣")! < finalValue.firstIndex(of: "🟢")!)
118119
#expect(finalValue.suffix(1) == "=")
119120
}
120121
}
121122
}
122-
123-

Tests/DispatchAsyncTests/DispatchQueueTests.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
//===----------------------------------------------------------------------===//
1414

1515
import Testing
16+
1617
@testable import DispatchAsync
1718

1819
#if !os(WASI)

Tests/DispatchAsyncTests/DispatchSemaphoreTests.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
//===----------------------------------------------------------------------===//
1414

1515
import Testing
16+
1617
@testable import DispatchAsync
1718

1819
nonisolated(unsafe) private var sharedPoolCompletionCount = 0

Tests/DispatchAsyncTests/DispatchTimeTests.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
//===----------------------------------------------------------------------===//
1414

1515
import Testing
16+
1617
@testable import DispatchAsync
1718

1819
@Test

0 commit comments

Comments
 (0)