Skip to content

Commit cb17d21

Browse files
[PM-26387] Fix lint warnings (#2007)
1 parent fbbb2a2 commit cb17d21

File tree

1,310 files changed

+10810
-10829
lines changed

Some content is hidden

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

1,310 files changed

+10810
-10829
lines changed

.swiftformat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# format options
22
--indent 4
33
--ifdef noindent
4-
--swiftversion 5.8.1
4+
--swiftversion 6.2
55
--header strip
66
--funcattributes prev-line
77
--typeattributes prev-line

Authenticator/Application/AppDelegate.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
3030

3131
func application(
3232
_: UIApplication,
33-
didFinishLaunchingWithOptions _: [UIApplication.LaunchOptionsKey: Any]? = nil
33+
didFinishLaunchingWithOptions _: [UIApplication.LaunchOptionsKey: Any]? = nil,
3434
) -> Bool {
3535
// Exit early if testing to avoid running any app functionality.
3636
guard !isTesting else { return true }
@@ -45,7 +45,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
4545

4646
let services = ServiceContainer(
4747
application: UIApplication.shared,
48-
errorReporter: errorReporter
48+
errorReporter: errorReporter,
4949
)
5050
let appModule = DefaultAppModule(services: services)
5151
appProcessor = AppProcessor(appModule: appModule, services: services)

Authenticator/Application/SceneDelegate.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
2626
func scene(
2727
_ scene: UIScene,
2828
willConnectTo session: UISceneSession,
29-
options connectionOptions: UIScene.ConnectionOptions
29+
options connectionOptions: UIScene.ConnectionOptions,
3030
) {
3131
guard let windowScene = scene as? UIWindowScene else { return }
3232
guard let appProcessor else {
@@ -56,7 +56,7 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
5656
await appProcessor.start(
5757
appContext: .mainApp,
5858
navigator: rootViewController,
59-
window: appWindow
59+
window: appWindow,
6060
)
6161
hideSplash()
6262
isStartingUp = false
@@ -84,7 +84,7 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
8484
window.isHidden = false
8585
window.rootViewController = UIStoryboard(
8686
name: "LaunchScreen",
87-
bundle: .main
87+
bundle: .main,
8888
).instantiateInitialViewController()
8989
window.windowLevel = UIWindow.Level.alert + 1
9090
return window
@@ -115,7 +115,7 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
115115
private func addTripleTapGestureRecognizer(to window: UIWindow) {
116116
let tapGesture = UITapGestureRecognizer(
117117
target: self,
118-
action: #selector(handleTripleTapGesture)
118+
action: #selector(handleTripleTapGesture),
119119
)
120120
tapGesture.numberOfTapsRequired = 3
121121
tapGesture.numberOfTouchesRequired = 1

AuthenticatorBridgeKit/AuthenticatorBridgeDataStore.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,13 @@ public class AuthenticatorBridgeDataStore {
6666
public init(
6767
errorReporter: ErrorReporter,
6868
groupIdentifier: String,
69-
storeType: AuthenticatorBridgeStoreType = .persisted
69+
storeType: AuthenticatorBridgeStoreType = .persisted,
7070
) {
7171
self.errorReporter = errorReporter
7272

7373
persistentContainer = NSPersistentContainer(
7474
name: authenticatorBridgeModelName,
75-
managedObjectModel: Self.managedObjectModel
75+
managedObjectModel: Self.managedObjectModel,
7676
)
7777
let storeDescription: NSPersistentStoreDescription
7878
switch storeType {
@@ -105,7 +105,7 @@ public class AuthenticatorBridgeDataStore {
105105
try await backgroundContext.perform {
106106
try self.backgroundContext.executeAndMergeChanges(
107107
batchDeleteRequest: request,
108-
additionalContexts: [self.persistentContainer.viewContext]
108+
additionalContexts: [self.persistentContainer.viewContext],
109109
)
110110
}
111111
}
@@ -118,7 +118,7 @@ public class AuthenticatorBridgeDataStore {
118118
try await backgroundContext.perform {
119119
try self.backgroundContext.executeAndMergeChanges(
120120
batchInsertRequest: request,
121-
additionalContexts: [self.persistentContainer.viewContext]
121+
additionalContexts: [self.persistentContainer.viewContext],
122122
)
123123
}
124124
}
@@ -132,13 +132,13 @@ public class AuthenticatorBridgeDataStore {
132132
///
133133
public func executeBatchReplace(
134134
deleteRequest: NSBatchDeleteRequest,
135-
insertRequest: NSBatchInsertRequest
135+
insertRequest: NSBatchInsertRequest,
136136
) async throws {
137137
try await backgroundContext.perform {
138138
try self.backgroundContext.executeAndMergeChanges(
139139
batchDeleteRequest: deleteRequest,
140140
batchInsertRequest: insertRequest,
141-
additionalContexts: [self.persistentContainer.viewContext]
141+
additionalContexts: [self.persistentContainer.viewContext],
142142
)
143143
}
144144
}

AuthenticatorBridgeKit/AuthenticatorBridgeItemData.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public class AuthenticatorBridgeItemData: NSManagedObject, CodableModelData {
2929
convenience init(
3030
context: NSManagedObjectContext,
3131
userId: String,
32-
authenticatorItem: AuthenticatorBridgeItemDataModel
32+
authenticatorItem: AuthenticatorBridgeItemDataModel,
3333
) throws {
3434
self.init(context: context)
3535
id = authenticatorItem.id
@@ -54,7 +54,7 @@ extension AuthenticatorBridgeItemData: ManagedUserObject {
5454
#keyPath(AuthenticatorBridgeItemData.userId),
5555
userId,
5656
#keyPath(AuthenticatorBridgeItemData.id),
57-
id
57+
id,
5858
)
5959
}
6060

AuthenticatorBridgeKit/AuthenticatorBridgeItemService.swift

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -154,10 +154,10 @@ public class DefaultAuthenticatorBridgeItemService: AuthenticatorBridgeItemServi
154154

155155
public func fetchTemporaryItem() async throws -> AuthenticatorBridgeItemDataView? {
156156
let decryptedItems = try await fetchAllForUserId(
157-
DefaultAuthenticatorBridgeItemService.temporaryUserId
157+
DefaultAuthenticatorBridgeItemService.temporaryUserId,
158158
)
159159
try await deleteAllForUserId(
160-
DefaultAuthenticatorBridgeItemService.temporaryUserId
160+
DefaultAuthenticatorBridgeItemService.temporaryUserId,
161161
)
162162

163163
return decryptedItems.first
@@ -178,14 +178,14 @@ public class DefaultAuthenticatorBridgeItemService: AuthenticatorBridgeItemServi
178178
forUserId userId: String) async throws {
179179
let encryptedItems = try await cryptoService.encryptAuthenticatorItems(items)
180180
try await dataStore.executeBatchInsert(
181-
AuthenticatorBridgeItemData.batchInsertRequest(objects: encryptedItems, userId: userId)
181+
AuthenticatorBridgeItemData.batchInsertRequest(objects: encryptedItems, userId: userId),
182182
)
183183
}
184184

185185
public func insertTemporaryItem(_ item: AuthenticatorBridgeItemDataView) async throws {
186186
try await replaceAllItems(
187187
with: [item],
188-
forUserId: DefaultAuthenticatorBridgeItemService.temporaryUserId
188+
forUserId: DefaultAuthenticatorBridgeItemService.temporaryUserId,
189189
)
190190
}
191191

@@ -201,11 +201,11 @@ public class DefaultAuthenticatorBridgeItemService: AuthenticatorBridgeItemServi
201201
let deleteRequest = AuthenticatorBridgeItemData.deleteByUserIdRequest(userId: userId)
202202
let insertRequest = try AuthenticatorBridgeItemData.batchInsertRequest(
203203
objects: encryptedItems,
204-
userId: userId
204+
userId: userId,
205205
)
206206
try await dataStore.executeBatchReplace(
207207
deleteRequest: deleteRequest,
208-
insertRequest: insertRequest
208+
insertRequest: insertRequest,
209209
)
210210
}
211211

@@ -214,13 +214,13 @@ public class DefaultAuthenticatorBridgeItemService: AuthenticatorBridgeItemServi
214214
try await checkForLogout()
215215
let fetchRequest = AuthenticatorBridgeItemData.fetchRequest(
216216
predicate: NSPredicate(
217-
format: "userId != %@", DefaultAuthenticatorBridgeItemService.temporaryUserId
218-
)
217+
format: "userId != %@", DefaultAuthenticatorBridgeItemService.temporaryUserId,
218+
),
219219
)
220220
fetchRequest.sortDescriptors = [NSSortDescriptor(keyPath: \AuthenticatorBridgeItemData.userId, ascending: true)]
221221
return FetchedResultsPublisher(
222222
context: dataStore.persistentContainer.viewContext,
223-
request: fetchRequest
223+
request: fetchRequest,
224224
)
225225
.map { dataItems in
226226
dataItems.compactMap(\.model)

AuthenticatorBridgeKit/Mocks/MockSharedTimeoutService.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public final class MockSharedTimeoutService: SharedTimeoutService {
2727
public func updateTimeout(
2828
forUserId userId: String,
2929
lastActiveDate: Date?,
30-
timeoutLength: SessionTimeoutValue
30+
timeoutLength: SessionTimeoutValue,
3131
) async throws {
3232
if let updateTimeoutError {
3333
throw updateTimeoutError

AuthenticatorBridgeKit/SharedCryptographyService.swift

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public protocol SharedCryptographyService: AnyObject {
1616
/// key is not in the shared repository.
1717
///
1818
func decryptAuthenticatorItems(
19-
_ items: [AuthenticatorBridgeItemDataModel]
19+
_ items: [AuthenticatorBridgeItemDataModel],
2020
) async throws -> [AuthenticatorBridgeItemDataView]
2121

2222
/// Takes an array of `AuthenticatorBridgeItemDataView` with decrypted data and
@@ -28,7 +28,7 @@ public protocol SharedCryptographyService: AnyObject {
2828
/// key is not in the shared repository.
2929
///
3030
func encryptAuthenticatorItems(
31-
_ items: [AuthenticatorBridgeItemDataView]
31+
_ items: [AuthenticatorBridgeItemDataView],
3232
) async throws -> [AuthenticatorBridgeItemDataModel]
3333
}
3434

@@ -55,7 +55,7 @@ public class DefaultAuthenticatorCryptographyService: SharedCryptographyService
5555
// MARK: Methods
5656

5757
public func decryptAuthenticatorItems(
58-
_ items: [AuthenticatorBridgeItemDataModel]
58+
_ items: [AuthenticatorBridgeItemDataModel],
5959
) async throws -> [AuthenticatorBridgeItemDataView] {
6060
guard !items.isEmpty else { return [] }
6161

@@ -70,13 +70,13 @@ public class DefaultAuthenticatorCryptographyService: SharedCryptographyService
7070
id: item.id,
7171
name: (try? decrypt(item.name, withKey: symmetricKey)) ?? "",
7272
totpKey: try? decrypt(item.totpKey, withKey: symmetricKey),
73-
username: try? decrypt(item.username, withKey: symmetricKey)
73+
username: try? decrypt(item.username, withKey: symmetricKey),
7474
)
7575
}
7676
}
7777

7878
public func encryptAuthenticatorItems(
79-
_ items: [AuthenticatorBridgeItemDataView]
79+
_ items: [AuthenticatorBridgeItemDataView],
8080
) async throws -> [AuthenticatorBridgeItemDataModel] {
8181
let key = try await sharedKeychainRepository.getAuthenticatorKey()
8282
let symmetricKey = SymmetricKey(data: key)
@@ -89,7 +89,7 @@ public class DefaultAuthenticatorCryptographyService: SharedCryptographyService
8989
id: item.id,
9090
name: encrypt(item.name, withKey: symmetricKey) ?? "",
9191
totpKey: encrypt(item.totpKey, withKey: symmetricKey),
92-
username: encrypt(item.username, withKey: symmetricKey)
92+
username: encrypt(item.username, withKey: symmetricKey),
9393
)
9494
}
9595
}
@@ -106,11 +106,11 @@ public class DefaultAuthenticatorCryptographyService: SharedCryptographyService
106106
return nil
107107
}
108108
let encryptedSealedBox = try AES.GCM.SealedBox(
109-
combined: data
109+
combined: data,
110110
)
111111
let decryptedBox = try AES.GCM.open(
112112
encryptedSealedBox,
113-
using: key
113+
using: key,
114114
)
115115
return String(data: decryptedBox, encoding: .utf8)
116116
}

AuthenticatorBridgeKit/SharedKeychain/SharedKeychainRepository.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public protocol SharedKeychainRepository {
2929
/// - Returns: The time the user should be automatically logged out. If `nil`, then the user should not be.
3030
///
3131
func getAccountAutoLogoutTime(
32-
userId: String
32+
userId: String,
3333
) async throws -> Date?
3434

3535
/// Sets when a user account should automatically log out.
@@ -40,7 +40,7 @@ public protocol SharedKeychainRepository {
4040
///
4141
func setAccountAutoLogoutTime(
4242
_ value: Date?,
43-
userId: String
43+
userId: String,
4444
) async throws
4545
}
4646

@@ -94,7 +94,7 @@ public class DefaultSharedKeychainRepository: SharedKeychainRepository {
9494
///
9595
public func setAccountAutoLogoutTime(
9696
_ value: Date?,
97-
userId: String
97+
userId: String,
9898
) async throws {
9999
try await storage.setValue(value, for: .accountAutoLogout(userId: userId))
100100
}

AuthenticatorBridgeKit/SharedKeychain/SharedKeychainRepositoryTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ final class SharedKeychainRepositoryTests: BitwardenTestCase {
1717
override func setUp() {
1818
storage = MockSharedKeychainStorage()
1919
subject = DefaultSharedKeychainRepository(
20-
storage: storage
20+
storage: storage,
2121
)
2222
}
2323

0 commit comments

Comments
 (0)