diff options
| author | Christian Cleberg <[email protected]> | 2026-07-20 16:22:28 -0500 |
|---|---|---|
| committer | Christian Cleberg <[email protected]> | 2026-07-20 16:27:59 -0500 |
| commit | bb18197860ffdb491f010648ec903003b6e1bb65 (patch) | |
| tree | e569d7cdeb1c14c7eab889cb7fac1ea9813e6efe /DomainDig/LocalNotificationService.swift | |
| parent | 083dfa723739eedd409ea8a6ae27332e48515210 (diff) | |
| download | domain-dig-bb18197860ffdb491f010648ec903003b6e1bb65.tar.gz domain-dig-bb18197860ffdb491f010648ec903003b6e1bb65.tar.bz2 domain-dig-bb18197860ffdb491f010648ec903003b6e1bb65.zip | |
v4.8.3: Clear SonarCloud new-code issues
Fixes the 4 reported bugs and ~97 code smells flagged in the new-code
period. No behavior changes.
Bugs (swift:S3923) — DomainInspectionService's confidenceFor* helpers each
returned `error == nil ? .low : .low`, an inert conditional. Simplified to
`return .low` and dropped the now-unused `error` parameter.
Smells:
- Merged 14 identical `.empty`/`.error` switch branches in DomainViewModel
- Consolidated duplicate implementations (clearPresentedResults/reset,
String.nonEmpty/nilIfEmpty, ExportFormat.id/fileExtension)
- Extracted nested ternaries into TLSGrade.tone, EmailSecurityGrade.tone,
and ChangeImpactClassification.color; removed ContentView.impactColor
and the duplicate mapping in BatchResultsView
- Documented empty closures and singleton inits
- Marked unused protocol-conformance parameters `_`
- Renamed CloudSyncTrigger.`import` to `imported` (raw value preserved)
and SSLSessionDelegate's _serverTrust/_tlsMetadata
- Merged nested ifs in the DER parser; flattened closure nesting in
PortScanService and IntegrationService
- Replaced two-case switches with if/else
Left open: S107 (init parameter counts), S115 (constants mirroring DoH and
ipapi JSON keys), S1075 (false positives on https:// literals), and two
S117 hits on SwiftUI $binding shorthand. These want a Won't Fix resolution
in SonarCloud, not a code change.
Diffstat (limited to 'DomainDig/LocalNotificationService.swift')
| -rw-r--r-- | DomainDig/LocalNotificationService.swift | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/DomainDig/LocalNotificationService.swift b/DomainDig/LocalNotificationService.swift index d3474e3..3648cb8 100644 --- a/DomainDig/LocalNotificationService.swift +++ b/DomainDig/LocalNotificationService.swift @@ -5,7 +5,7 @@ import UserNotifications final class LocalNotificationService { static let shared = LocalNotificationService() - private init() {} + private init() { /* Singleton; use the shared instance. */ } static let domainUserInfoKey = "domain" static let domainCategoryIdentifier = "domain-event" @@ -188,14 +188,14 @@ private final class NotificationCenterDelegate: NSObject, UNUserNotificationCent static let shared = NotificationCenterDelegate() func userNotificationCenter( - _ center: UNUserNotificationCenter, - willPresent notification: UNNotification + _: UNUserNotificationCenter, + willPresent _: UNNotification ) async -> UNNotificationPresentationOptions { [.banner, .list, .sound] } func userNotificationCenter( - _ center: UNUserNotificationCenter, + _: UNUserNotificationCenter, didReceive response: UNNotificationResponse ) async { let userInfo = response.notification.request.content.userInfo @@ -204,10 +204,9 @@ private final class NotificationCenterDelegate: NSObject, UNUserNotificationCent else { return } let action: DomainDigDeepLink.Action - switch response.actionIdentifier { - case LocalNotificationService.reinspectActionIdentifier: + if response.actionIdentifier == LocalNotificationService.reinspectActionIdentifier { action = .inspect(domain) - default: + } else { // Default tap: open the tracked domain's detail. action = .detail(domain) } |
