Skip to content

Commit 942ade5

Browse files
committed
chore: bump nixpkgs and apply new swiftformat/swiftlint/zizmor rules
1 parent a494aeb commit 942ade5

63 files changed

Lines changed: 477 additions & 434 deletions

Some content is hidden

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

‎.github/dependabot.yaml‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ updates:
66
interval: "weekly"
77
time: "06:00"
88
timezone: "America/Chicago"
9+
cooldown:
10+
default-days: 7
911
labels: []
1012
commit-message:
1113
prefix: "ci"

‎.github/zizmor.yml‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
rules:
2+
# `uses: $/...` isn't understood by actionlint yet, so keep using `./...`
3+
# until https://github.com/rhysd/actionlint/issues/711 is resolved.
4+
self-repository:
5+
disable: true

‎Coder-Desktop/.swiftformat‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
--selfrequired log,info,error,debug,critical,fault
22
--exclude **.pb.swift,**.grpc.swift
33
--condassignment always
4-
--disable unusedArguments
4+
--disable unusedArguments,wrapPropertyBodies

‎Coder-Desktop/Coder-Desktop/About.swift‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import SwiftUI
22

33
enum About {
4-
public static let repo: String = "https://github.com/coder/coder-desktop-macos"
4+
static let repo: String = "https://github.com/coder/coder-desktop-macos"
55
private static var credits: NSAttributedString {
66
let coder = NSMutableAttributedString(
77
string: "Coder.com",

‎Coder-Desktop/Coder-Desktop/AppHelperXPCClient.swift‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import NetworkExtension
33
import os
44
import VPNLib
55

6-
// This is the client for the app to communicate with the privileged helper.
6+
/// This is the client for the app to communicate with the privileged helper.
77
@objc final class HelperXPCClient: NSObject, @unchecked Sendable {
88
private var svc: CoderVPNService
99
private let logger = Logger(subsystem: Bundle.main.bundleIdentifier!, category: "HelperXPCClient")
@@ -43,7 +43,7 @@ import VPNLib
4343
return connection
4444
}
4545

46-
// Establishes a connection to the Helper, so it can send messages back.
46+
/// Establishes a connection to the Helper, so it can send messages back.
4747
func ping() async throws {
4848
let conn = connect()
4949
return try await withCheckedThrowingContinuation { continuation in
@@ -83,7 +83,7 @@ import VPNLib
8383
}
8484
}
8585

86-
// These methods are called by the Helper over XPC
86+
/// These methods are called by the Helper over XPC
8787
extension HelperXPCClient: AppXPCInterface {
8888
func onPeerUpdate(_ diff: Data, reply: @escaping () -> Void) {
8989
let reply = CompletionWrapper(reply)

‎Coder-Desktop/Coder-Desktop/Coder_DesktopApp.swift‎

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,8 @@ class AppDelegate: NSObject, NSApplicationDelegate {
141141
NotificationCenter.default.removeObserver(self)
142142
}
143143

144-
// This function MUST eventually call `NSApp.reply(toApplicationShouldTerminate: true)`
145-
// or return `.terminateNow`
144+
/// This function MUST eventually call `NSApp.reply(toApplicationShouldTerminate: true)`
145+
/// or return `.terminateNow`
146146
func applicationShouldTerminate(_: NSApplication) -> NSApplication.TerminateReply {
147147
Task {
148148
async let vpnTask: Void = {
@@ -214,15 +214,15 @@ class AppDelegate: NSObject, NSApplicationDelegate {
214214
alert.addButton(withTitle: "OK")
215215
let response = alert.runModal()
216216
state.skipHiddenIconAlert = suppressCheckbox.state == .on
217-
if #available(macOS 26, *), response == .alertFirstButtonReturn {
218-
// We'll need to ensure this continues to work in future macOS versions
219-
if !NSWorkspace.shared.open(
220-
URL(string: "x-apple.systempreferences:com.apple.ControlCenter-Settings.extension?MenuBar")!
221-
) {
222-
NSWorkspace.shared.open(
223-
URL(string: "x-apple.systempreferences:com.apple.ControlCenter-Settings.extension")!
224-
)
225-
}
217+
if #available(macOS 26, *), response == .alertFirstButtonReturn,
218+
// We'll need to ensure this continues to work in future macOS versions
219+
!NSWorkspace.shared.open(
220+
URL(string: "x-apple.systempreferences:com.apple.ControlCenter-Settings.extension?MenuBar")!
221+
)
222+
{
223+
NSWorkspace.shared.open(
224+
URL(string: "x-apple.systempreferences:com.apple.ControlCenter-Settings.extension")!
225+
)
226226
}
227227
}
228228
}

‎Coder-Desktop/Coder-Desktop/MenuBarController.swift‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,19 @@ class MenuBarController {
3434
}
3535

3636
func startAnimation() {
37-
if animationTask != nil { return }
37+
if animationTask != nil {
38+
return
39+
}
3840
animationTask = Task {
3941
defer { animationTask = nil }
4042
let totalFrames = 60
4143
let cycleDurationMs: UInt64 = 2000
4244
let frameDurationMs = cycleDurationMs / UInt64(totalFrames - 1)
4345
repeat {
4446
for frame in 0 ..< totalFrames {
45-
if Task.isCancelled { break }
47+
if Task.isCancelled {
48+
break
49+
}
4650
let progress = Double(frame) / Double(totalFrames - 1)
4751
let alpha = 0.3 + 0.7 * (0.5 - 0.5 * cos(2 * Double.pi * progress))
4852
menuBarExtra.setOpacity(CGFloat(alpha))

‎Coder-Desktop/Coder-Desktop/Notifications.swift‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ extension AppDelegate: UNUserNotificationCenterDelegate {
99
)
1010
}
1111

12-
// This function is required for notifications to appear as banners whilst the app is running.
13-
// We're effectively forwarding the notification back to the OS
12+
/// This function is required for notifications to appear as banners whilst the app is running.
13+
/// We're effectively forwarding the notification back to the OS
1414
nonisolated func userNotificationCenter(
1515
_: UNUserNotificationCenter,
1616
willPresent _: UNNotification

‎Coder-Desktop/Coder-Desktop/State.swift‎

Lines changed: 21 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class AppState: ObservableObject {
1212

1313
let dangerousDisableCoderSignatureValidation: Bool
1414

15-
// Stored in UserDefaults
15+
/// Stored in UserDefaults
1616
@Published private(set) var hasSession: Bool {
1717
didSet {
1818
guard persistent else { return }
@@ -31,15 +31,15 @@ class AppState: ObservableObject {
3131

3232
static let defaultHostnameSuffix: String = "coder"
3333

34-
// Stored in Keychain
34+
/// Stored in Keychain
3535
@Published private(set) var sessionToken: String? {
3636
didSet {
3737
guard persistent else { return }
3838
keychainSet(sessionToken, for: Keys.sessionToken)
3939
}
4040
}
4141

42-
public var client: Client?
42+
var client: Client?
4343

4444
@Published var useLiteralHeaders: Bool = UserDefaults.standard.bool(forKey: Keys.useLiteralHeaders) {
4545
didSet {
@@ -57,7 +57,7 @@ class AppState: ObservableObject {
5757
}
5858
}
5959

60-
// Defaults to `true`
60+
/// Defaults to `true`
6161
@Published var stopVPNOnQuit: Bool = UserDefaults.standard.optionalBool(forKey: Keys.stopVPNOnQuit) ?? true {
6262
didSet {
6363
guard persistent else { return }
@@ -80,7 +80,9 @@ class AppState: ObservableObject {
8080
}
8181

8282
func tunnelProviderProtocol() -> NETunnelProviderProtocol? {
83-
if !hasSession { return nil }
83+
if !hasSession {
84+
return nil
85+
}
8486
let proto = NETunnelProviderProtocol()
8587
proto.providerBundleIdentifier = "\(appId).VPN"
8688
// HACK: We can't write to the system keychain, and the user keychain
@@ -100,13 +102,15 @@ class AppState: ObservableObject {
100102

101103
private let onChange: ((NETunnelProviderProtocol?) -> Void)?
102104

103-
// reconfigure must be called when any property used to configure the VPN changes
104-
public func reconfigure() {
105-
if let onChange { onChange(tunnelProviderProtocol()) }
105+
/// reconfigure must be called when any property used to configure the VPN changes
106+
func reconfigure() {
107+
if let onChange {
108+
onChange(tunnelProviderProtocol())
109+
}
106110
}
107111

108-
public init(onChange: ((NETunnelProviderProtocol?) -> Void)? = nil,
109-
persistent: Bool = true)
112+
init(onChange: ((NETunnelProviderProtocol?) -> Void)? = nil,
113+
persistent: Bool = true)
110114
{
111115
self.persistent = persistent
112116
self.onChange = onChange
@@ -141,7 +145,7 @@ class AppState: ObservableObject {
141145
}
142146
}
143147

144-
public func login(baseAccessURL: URL, sessionToken: String) {
148+
func login(baseAccessURL: URL, sessionToken: String) {
145149
hasSession = true
146150
self.baseAccessURL = baseAccessURL
147151
self.sessionToken = sessionToken
@@ -154,7 +158,7 @@ class AppState: ObservableObject {
154158
reconfigure()
155159
}
156160

157-
public func handleTokenExpiry() async {
161+
func handleTokenExpiry() async {
158162
if hasSession {
159163
do {
160164
_ = try await client!.user("me")
@@ -172,13 +176,13 @@ class AppState: ObservableObject {
172176
}
173177

174178
private var refreshTask: Task<String?, Never>?
175-
public func refreshDeploymentConfig() async {
179+
func refreshDeploymentConfig() async {
176180
// Client is non-nil if there's a sesssion
177181
if hasSession, let client {
178182
refreshTask?.cancel()
179183

180184
refreshTask = Task {
181-
let res = try? await retry(floor: .milliseconds(100), ceil: .seconds(10)) {
185+
try? await retry(floor: .milliseconds(100), ceil: .seconds(10)) {
182186
do {
183187
let config = try await client.agentConnectionInfoGeneric()
184188
return config.hostname_suffix
@@ -187,14 +191,13 @@ class AppState: ObservableObject {
187191
throw error
188192
}
189193
}
190-
return res
191194
}
192195

193196
hostnameSuffix = await refreshTask?.value ?? Self.defaultHostnameSuffix
194197
}
195198
}
196199

197-
public func clearSession() {
200+
func clearSession() {
198201
hasSession = false
199202
sessionToken = nil
200203
refreshTask?.cancel()
@@ -237,11 +240,6 @@ struct LiteralHeader: Hashable, Identifiable, Equatable, Codable {
237240
var id: String {
238241
"\(name):\(value)"
239242
}
240-
241-
init(name: String, value: String) {
242-
self.name = name
243-
self.value = value
244-
}
245243
}
246244

247245
extension LiteralHeader {
@@ -251,8 +249,8 @@ extension LiteralHeader {
251249
}
252250

253251
extension UserDefaults {
254-
// Unlike the exisitng `bool(forKey:)` method which returns `false` for both
255-
// missing values this method can return `nil`.
252+
/// Unlike the exisitng `bool(forKey:)` method which returns `false` for both
253+
/// missing values this method can return `nil`.
256254
func optionalBool(forKey key: String) -> Bool? {
257255
guard object(forKey: key) != nil else {
258256
return nil

‎Coder-Desktop/Coder-Desktop/UpdaterService.swift‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ import Sparkle
22
import SwiftUI
33

44
final class UpdaterService: NSObject, ObservableObject {
5-
// The auto-updater can be entirely disabled by setting the
6-
// `disableUpdater` UserDefaults key to `true`. This is designed for use in
7-
// MDM configurations, where the value can be set to `true` permanently.
5+
/// The auto-updater can be entirely disabled by setting the
6+
/// `disableUpdater` UserDefaults key to `true`. This is designed for use in
7+
/// MDM configurations, where the value can be set to `true` permanently.
88
let disabled: Bool = UserDefaults.standard.bool(forKey: Keys.disableUpdater)
99

1010
@Published var canCheckForUpdates = true

0 commit comments

Comments
 (0)