Skip to content

Commit 8af7dde

Browse files
committed
fix(swiftformat): Enforced omission of trailing commas.
Signed-off-by: Iva Horn <iva.horn@nextcloud.com>
1 parent aef90f0 commit 8af7dde

18 files changed

Lines changed: 43 additions & 42 deletions

.swiftformat

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
--indent-case true
2+
--trailing-commas never

Package.swift

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,21 @@ let package = Package(
88
platforms: [
99
.iOS(.v16),
1010
.macOS(.v11),
11-
.visionOS(.v1),
11+
.visionOS(.v1)
1212
],
1313
products: [
1414
// Products define the executables and libraries a package produces, making them visible to other packages.
1515
.library(
1616
name: "NextcloudFileProviderKit",
1717
targets: ["NextcloudFileProviderKit"]
18-
),
18+
)
1919
],
2020
dependencies: [
2121
.package(url: "https://github.com/nextcloud/NextcloudCapabilitiesKit.git", from: "2.3.0"),
2222
.package(url: "https://github.com/nextcloud/NextcloudKit", from: "7.0.0"),
2323
.package(url: "https://github.com/nicklockwood/SwiftFormat", from: "0.55.0"),
2424
.package(url: "https://github.com/realm/realm-swift.git", from: "20.0.1"),
25-
.package(url: "https://github.com/apple/swift-nio.git", from: "2.0.0"),
25+
.package(url: "https://github.com/apple/swift-nio.git", from: "2.0.0")
2626
],
2727
targets: [
2828
// Targets are the basic building blocks of a package, defining a module or a test suite.
@@ -32,13 +32,13 @@ let package = Package(
3232
dependencies: [
3333
.product(name: "NextcloudCapabilitiesKit", package: "NextcloudCapabilitiesKit"),
3434
.product(name: "NextcloudKit", package: "NextcloudKit"),
35-
.product(name: "RealmSwift", package: "realm-swift"),
35+
.product(name: "RealmSwift", package: "realm-swift")
3636
]
3737
),
3838
.target(
3939
name: "NextcloudFileProviderKitMocks",
4040
dependencies: [
41-
"NextcloudFileProviderKit",
41+
"NextcloudFileProviderKit"
4242
]
4343
),
4444
.target(
@@ -49,7 +49,7 @@ let package = Package(
4949
.product(name: "NIOCore", package: "swift-nio"),
5050
.product(name: "NIOPosix", package: "swift-nio"),
5151
.product(name: "NIOHTTP1", package: "swift-nio"),
52-
.product(name: "NIOWebSocket", package: "swift-nio"),
52+
.product(name: "NIOWebSocket", package: "swift-nio")
5353
],
5454
path: "Tests/Interface"
5555
),
@@ -61,6 +61,6 @@ let package = Package(
6161
.testTarget(
6262
name: "NextcloudFileProviderKitTests",
6363
dependencies: ["NextcloudFileProviderKit", "TestInterface"]
64-
),
64+
)
6565
]
6666
)

Sources/NextcloudFileProviderKit/Database/FilesDatabaseManager.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -300,14 +300,14 @@ public final class FilesDatabaseManager: Sendable {
300300
.item: updatedMetadata.ocId,
301301
.eTag: updatedMetadata.etag,
302302
.name: updatedMetadata.fileName,
303-
.syncTime: updatedMetadata.syncTime.description,
303+
.syncTime: updatedMetadata.syncTime.description
304304
])
305305
} else {
306306
logger.debug("Skipping item metadata update; same as existing, or still in transit.", [
307307
.item: updatedMetadata.ocId,
308308
.eTag: updatedMetadata.etag,
309309
.name: updatedMetadata.fileName,
310-
.syncTime: updatedMetadata.syncTime.description,
310+
.syncTime: updatedMetadata.syncTime.description
311311
])
312312
}
313313

@@ -459,7 +459,7 @@ public final class FilesDatabaseManager: Sendable {
459459
.item: metadata.ocId,
460460
.eTag: metadata.etag,
461461
.name: metadata.fileName,
462-
.syncTime: metadata.syncTime,
462+
.syncTime: metadata.syncTime
463463
])
464464
}
465465
return SendableItemMetadata(value: result)
@@ -468,7 +468,7 @@ public final class FilesDatabaseManager: Sendable {
468468
.item: metadata.ocId,
469469
.eTag: metadata.etag,
470470
.error: error,
471-
.name: metadata.fileName,
471+
.name: metadata.fileName
472472
])
473473
}
474474

@@ -571,7 +571,7 @@ public final class FilesDatabaseManager: Sendable {
571571
logger.error("Could not retrieve parent item identifier remotely.", [
572572
.error: error,
573573
.item: metadata.ocId,
574-
.name: metadata.fileName,
574+
.name: metadata.fileName
575575
])
576576

577577
return nil

Sources/NextcloudFileProviderKit/Item/Item+Create.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ public extension Item {
251251
"""
252252
)
253253
let attributesToFetch: Set<URLResourceKey> = [
254-
.isDirectoryKey, .fileSizeKey, .creationDateKey, .contentModificationDateKey,
254+
.isDirectoryKey, .fileSizeKey, .creationDateKey, .contentModificationDateKey
255255
]
256256
let fm = FileManager.default
257257
guard let enumerator = fm.enumerator(

Sources/NextcloudFileProviderKit/Item/Item+Modify.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ public extension Item {
318318
}
319319

320320
let attributesToFetch: Set<URLResourceKey> = [
321-
.isDirectoryKey, .fileSizeKey, .creationDateKey, .contentModificationDateKey,
321+
.isDirectoryKey, .fileSizeKey, .creationDateKey, .contentModificationDateKey
322322
]
323323
let fm = FileManager.default
324324
guard let enumerator = fm.enumerator(

Sources/NextcloudFileProviderKit/Item/Item.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -177,19 +177,19 @@ public class Item: NSObject, NSFileProviderItem {
177177
return [
178178
.hidden,
179179
.userReadable,
180-
.userWritable,
180+
.userWritable
181181
]
182182
}
183183

184184
if metadata.lock, metadata.lockOwnerType != NKLockType.user.rawValue || metadata.lockOwner != account.username, metadata.lockTimeOut ?? Date() > Date() {
185185
return [
186-
.userReadable,
186+
.userReadable
187187
]
188188
}
189189

190190
return [
191191
.userReadable,
192-
.userWritable,
192+
.userWritable
193193
]
194194
}
195195

Sources/NextcloudFileProviderKit/Log/FileProviderLogDetail.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ public enum FileProviderLogDetail: Encodable {
102102
self = .dictionary([
103103
"code": .int(error.code),
104104
"domain": .string(error.domain),
105-
"localizedDescription": .string(error.localizedDescription),
105+
"localizedDescription": .string(error.localizedDescription)
106106
])
107107
} else if let error = someValue as? Error {
108108
self = .string(error.localizedDescription)
@@ -134,13 +134,13 @@ public enum FileProviderLogDetail: Encodable {
134134
"syncTime": .date(metadata.syncTime),
135135
"trashbinFileName": .string(metadata.trashbinFileName),
136136
"uploaded": .bool(metadata.uploaded),
137-
"visitedDirectory": .bool(metadata.visitedDirectory),
137+
"visitedDirectory": .bool(metadata.visitedDirectory)
138138
])
139139
} else if let request = someValue as? NSFileProviderRequest {
140140
self = .dictionary([
141141
"requestingExecutable": .string(request.requestingExecutable?.path ?? "nil"),
142142
"isFileViewerRequest": .bool(request.isFileViewerRequest),
143-
"isSystemRequest": .bool(request.isSystemRequest),
143+
"isSystemRequest": .bool(request.isSystemRequest)
144144
])
145145
} else if let lock = someValue as? NKLock {
146146
self = .dictionary([
@@ -150,7 +150,7 @@ public enum FileProviderLogDetail: Encodable {
150150
"ownerType": .int(lock.ownerType.rawValue),
151151
"time": lock.time == nil ? .null : .date(lock.time!),
152152
"timeOut": lock.timeOut == nil ? .null : .date(lock.timeOut!),
153-
"token": lock.token == nil ? .null : .string(lock.token!),
153+
"token": lock.token == nil ? .null : .string(lock.token!)
154154
])
155155
} else {
156156
self = .string("Unsupported log detail type: \(String(describing: someValue.self))")

Sources/NextcloudFileProviderKit/Metadata/ItemMetadata.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ public extension ItemMetadata {
168168
.init(name: "fileId", value: fileId),
169169
.init(name: "x", value: "\(size.width)"),
170170
.init(name: "y", value: "\(size.height)"),
171-
.init(name: "a", value: "true"),
171+
.init(name: "a", value: "true")
172172
])
173173
}
174174

Sources/NextcloudFileProviderKit/Utilities/Account.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ public struct Account: CustomStringConvertible, Equatable, Sendable {
8787
AccountDictDavFilesUrlKey: davFilesUrl,
8888
AccountDictTrashUrlKey: trashUrl,
8989
AccountDictTrashRestoreUrlKey: trashRestoreUrl,
90-
AccountDictFileNameKey: fileName,
90+
AccountDictFileNameKey: fileName
9191
]
9292
}
9393
}

Tests/InterfaceTests/MockRemoteInterfaceTests.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ final class MockRemoteInterfaceTests: XCTestCase {
283283
fileName: String(3),
284284
size: Int64(data.count - (chunkSize * 2)),
285285
remoteChunkStoreFolderName: uploadUuid
286-
),
286+
)
287287
],
288288
creationDate: .init(),
289289
modificationDate: .init(),
@@ -522,7 +522,7 @@ final class MockRemoteInterfaceTests: XCTestCase {
522522
remoteInterface.rootItem?.identifier,
523523
itemA.identifier,
524524
itemB.identifier,
525-
itemC.identifier,
525+
itemC.identifier
526526
]
527527
)
528528

0 commit comments

Comments
 (0)