Skip to content

Commit a3ba8a0

Browse files
committed
fix: resolve SwiftLint errors in terminal, MCP, and JSON viewer
1 parent 03b8d7f commit a3ba8a0

4 files changed

Lines changed: 14 additions & 16 deletions

File tree

TablePro/Core/MCP/MCPMessageTypes.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -423,4 +423,3 @@ struct MCPResourceContent: Codable, Sendable {
423423
struct MCPResourceReadResult: Codable, Sendable {
424424
let contents: [MCPResourceContent]
425425
}
426-

TablePro/Core/Terminal/TerminalProcessManager.swift

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,17 @@ final class TerminalProcessManager {
1212
private static let logger = Logger(subsystem: "com.TablePro", category: "TerminalProcessManager")
1313

1414
private let fdLock = NSLock()
15-
private nonisolated(unsafe) var _ptyFD: Int32 = -1
15+
nonisolated(unsafe) private var _ptyFD: Int32 = -1
1616

1717
private var ptyFD: Int32 {
1818
get { fdLock.withLock { _ptyFD } }
1919
set { fdLock.withLock { _ptyFD = newValue } }
2020
}
2121

2222
private let stateLock = NSLock()
23-
private nonisolated(unsafe) var _childPID: pid_t = 0
24-
private nonisolated(unsafe) var _readSource: DispatchSourceRead?
25-
private nonisolated(unsafe) var _processMonitor: DispatchSourceProcess?
23+
nonisolated(unsafe) private var _childPID: pid_t = 0
24+
nonisolated(unsafe) private var _readSource: DispatchSourceRead?
25+
nonisolated(unsafe) private var _processMonitor: DispatchSourceProcess?
2626

2727
var onData: ((Data) -> Void)?
2828
var onExit: ((Int32) -> Void)?
@@ -66,7 +66,7 @@ final class TerminalProcessManager {
6666

6767
if pid == 0 {
6868
// Child process: ONLY async-signal-safe POSIX calls, no Swift
69-
execve(cArgs[0]!, cArgs, cEnv)
69+
execve(cArgs[0]!, cArgs, cEnv) // swiftlint:disable:this force_unwrapping
7070
_exit(127)
7171
}
7272

@@ -105,8 +105,8 @@ final class TerminalProcessManager {
105105

106106
// MARK: - Resize (called from libghostty threads)
107107

108-
private nonisolated(unsafe) var lastCols: Int = 0
109-
private nonisolated(unsafe) var lastRows: Int = 0
108+
nonisolated(unsafe) private var lastCols: Int = 0
109+
nonisolated(unsafe) private var lastRows: Int = 0
110110
private let resizeLock = NSLock()
111111

112112
nonisolated func resize(cols: Int, rows: Int) {
@@ -154,7 +154,7 @@ final class TerminalProcessManager {
154154
}
155155
}
156156

157-
private nonisolated func killAndReap() {
157+
nonisolated private func killAndReap() {
158158
let pid = stateLock.withLock {
159159
let p = _childPID
160160
_childPID = 0
@@ -169,7 +169,7 @@ final class TerminalProcessManager {
169169
}
170170
}
171171

172-
private nonisolated func cancelSources() {
172+
nonisolated private func cancelSources() {
173173
stateLock.withLock {
174174
_readSource?.cancel()
175175
_readSource = nil

TablePro/Models/Settings/MCPSettings.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ struct MCPSettings: Codable, Equatable {
1717

1818
static let `default` = MCPSettings(
1919
enabled: false,
20-
port: 23508,
20+
port: 23_508,
2121
defaultRowLimit: 500,
2222
maxRowLimit: 10_000,
2323
queryTimeoutSeconds: 30,
@@ -26,7 +26,7 @@ struct MCPSettings: Codable, Equatable {
2626

2727
init(
2828
enabled: Bool = false,
29-
port: Int = 23508,
29+
port: Int = 23_508,
3030
defaultRowLimit: Int = 500,
3131
maxRowLimit: Int = 10_000,
3232
queryTimeoutSeconds: Int = 30,
@@ -43,8 +43,8 @@ struct MCPSettings: Codable, Equatable {
4343
init(from decoder: Decoder) throws {
4444
let container = try decoder.container(keyedBy: CodingKeys.self)
4545
enabled = try container.decodeIfPresent(Bool.self, forKey: .enabled) ?? false
46-
let rawPort = try container.decodeIfPresent(Int.self, forKey: .port) ?? 23508
47-
port = (1...65535).contains(rawPort) ? rawPort : 23508
46+
let rawPort = try container.decodeIfPresent(Int.self, forKey: .port) ?? 23_508
47+
port = (1...65_535).contains(rawPort) ? rawPort : 23_508
4848
defaultRowLimit = try container.decodeIfPresent(Int.self, forKey: .defaultRowLimit) ?? 500
4949
maxRowLimit = try container.decodeIfPresent(Int.self, forKey: .maxRowLimit) ?? 10_000
5050
queryTimeoutSeconds = try container.decodeIfPresent(Int.self, forKey: .queryTimeoutSeconds) ?? 30

TablePro/Views/Results/JSONTreeView.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,8 +149,7 @@ private struct JSONTreeContentView: View {
149149
isExpanded: Binding(
150150
get: { expandedNodeIDs.contains(node.id) },
151151
set: { expanded in
152-
if expanded { expandedNodeIDs.insert(node.id) }
153-
else { expandedNodeIDs.remove(node.id) }
152+
if expanded { expandedNodeIDs.insert(node.id) } else { expandedNodeIDs.remove(node.id) }
154153
}
155154
)
156155
) {

0 commit comments

Comments
 (0)