Skip to content

Commit 435a773

Browse files
committed
[Lint] Lint files
1 parent c0ba585 commit 435a773

15 files changed

+111
-112
lines changed

Sources/StarterGame/BallSystem.swift

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -100,14 +100,15 @@ var BallComponent_Editor: ComponentOption_Editor = .init(
100100
name: "Ball Component",
101101
type: BallComponent.self,
102102
view: makeEditorView(fields: [
103-
.text(label: "Ball Component",
103+
.text(label: "Ball Component",
104104
placeholder: "Entity name",
105-
get: {entityId in
106-
getEntityName(entityId: entityId) ?? "None"},
105+
get: { entityId in
106+
getEntityName(entityId: entityId) ?? "None"
107+
},
107108
set: { entityId, targetName in
108-
setEntityName(entityId: entityId, name: targetName)
109-
})
110-
109+
setEntityName(entityId: entityId, name: targetName)
110+
}),
111+
111112
]),
112113
onAdd: { entityId in
113114
registerComponent(entityId: entityId, componentType: BallComponent.self)

Sources/StarterGame/CameraFollow.swift

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -114,23 +114,23 @@ var CameraFollowComponent_Editor: ComponentOption_Editor = .init(
114114
name: "Camera Follow",
115115
type: CameraFollowComponent.self,
116116
view: makeEditorView(fields: [
117-
118117
.text(label: "Target Name",
119118
placeholder: "Entity name",
120-
get: {entityId in
121-
getTargetName(entityId: entityId) ?? "None"},
119+
get: { entityId in
120+
getTargetName(entityId: entityId) ?? "None"
121+
},
122122
set: { entityId, targetName in
123-
setTargetName(entityId: entityId, name: targetName)
123+
setTargetName(entityId: entityId, name: targetName)
124124
}),
125-
125+
126126
.vector3(label: "Offset",
127127
get: { entityId in
128128
getOffsetTarget(entityId: entityId)
129129
},
130130
set: { entityId, newOffset in
131131
setOffsetTarget(entityId: entityId, offset: newOffset)
132-
})
133-
132+
}),
133+
134134
]),
135135
onAdd: { entityId in
136136
registerComponent(entityId: entityId, componentType: CameraFollowComponent.self)

Sources/StarterGame/DribblingSystem.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ var DribblingComponent_Editor: ComponentOption_Editor = .init(
165165
},
166166
set: { entityId, newDirection in
167167
setPlayerDirection(entityId: entityId, direction: newDirection)
168-
})
168+
}),
169169
]),
170170
onAdd: { entityId in
171171
registerComponent(entityId: entityId, componentType: DribblinComponent.self)

Sources/StarterGame/main.swift

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class GameScene {
1515
// 1. Register custom system
1616
// 2. add component to editor
1717
// 3. encode/decode custom component
18-
18+
1919
registerCustomSystem(ballSystemUpdate)
2020
addComponent_Editor(componentOption: BallComponent_Editor)
2121
encodeCustomComponent(type: BallComponent.self)
@@ -25,23 +25,20 @@ class GameScene {
2525
encodeCustomComponent(
2626
type: DribblinComponent.self,
2727
merge: { current, decoded in
28-
current.maxSpeed = decoded.maxSpeed
28+
current.maxSpeed = decoded.maxSpeed
2929
current.kickSpeed = decoded.kickSpeed
3030
current.direction = decoded.direction
3131
}
3232
)
33-
33+
3434
registerCustomSystem(cameraFollowUpdate)
3535
addComponent_Editor(componentOption: CameraFollowComponent_Editor)
3636
encodeCustomComponent(type: CameraFollowComponent.self,
37-
merge: {current, decoded in
38-
current.targetName = decoded.targetName
39-
current.offset = decoded.offset
40-
})
41-
42-
43-
44-
37+
merge: { current, decoded in
38+
current.targetName = decoded.targetName
39+
current.offset = decoded.offset
40+
})
41+
4542
/*
4643
//Example: Load game
4744

Sources/UntoldEngine/ECS/ComponentPool.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,10 @@ public struct ComponentMask: Equatable, Hashable {
9898
}
9999

100100
@inlinable
101-
func makeMask<S: Sequence<Int>>(from componentTypes: S) -> ComponentMask {
101+
func makeMask(from componentTypes: some Sequence<Int>) -> ComponentMask {
102102
var m = ComponentMask()
103103
for c in componentTypes {
104-
if c >= 0 && c < 64 { m.set(c) }
104+
if c >= 0, c < 64 { m.set(c) }
105105
}
106106
return m
107107
}

Sources/UntoldEngine/Editor/AssetBrowserView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@ struct AssetBrowserView: View {
386386
}
387387

388388
@ViewBuilder
389-
private func folderContentsView(for folder: URL, selectionManager: SelectionManager) -> some View {
389+
private func folderContentsView(for folder: URL, selectionManager _: SelectionManager) -> some View {
390390
if let contents = try? FileManager.default.contentsOfDirectory(at: folder, includingPropertiesForKeys: nil, options: .skipsHiddenFiles) {
391391
let items = contents.compactMap { item -> Asset? in
392392
var isDir: ObjCBool = false

Sources/UntoldEngine/Editor/ComponentEditorForm.swift

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ public enum EditorField {
1717
case vector3(label: String,
1818
get: (EntityID) -> SIMD3<Float>,
1919
set: (EntityID, SIMD3<Float>) -> Void)
20-
20+
2121
case text(label: String,
22-
placeholder: String?,
23-
get: (EntityID) -> String,
24-
set: (EntityID, String) -> Void)
22+
placeholder: String?,
23+
get: (EntityID) -> String,
24+
set: (EntityID, String) -> Void)
2525
}
2626

2727
// 2) Render fields into controls, wiring refreshView automatically
@@ -51,22 +51,20 @@ public struct ComponentForm: View {
5151
set: { newValue in set(entityId, newValue); refresh() }
5252
)
5353
)
54-
54+
5555
case let .text(label, placeholder, get, set):
56-
HStack {
57-
Text(label)
58-
.font(.caption)
59-
.foregroundColor(.secondary)
60-
TextField(placeholder ?? "",
61-
text: Binding(
62-
get: { get(entityId) },
63-
set: { newValue in set(entityId, newValue); refresh() }
64-
)
65-
)
66-
.textFieldStyle(.roundedBorder)
67-
}
56+
HStack {
57+
Text(label)
58+
.font(.caption)
59+
.foregroundColor(.secondary)
60+
TextField(placeholder ?? "",
61+
text: Binding(
62+
get: { get(entityId) },
63+
set: { newValue in set(entityId, newValue); refresh() }
64+
))
65+
.textFieldStyle(.roundedBorder)
66+
}
6867
}
69-
7068
}
7169
}
7270
}

Sources/UntoldEngine/Editor/InspectorView.swift

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ var availableComponents_Editor: [ComponentOption_Editor] = [
6464
AnyView(
6565
Group {
6666
if let entityId = selectedId {
67-
RenderingEditorView(entityId: entityId, asset: asset, refreshView: refreshView)
67+
RenderingEditorView(entityId: entityId, asset: asset, refreshView: refreshView)
6868
}
6969
}
7070
)
@@ -100,7 +100,7 @@ var availableComponents_Editor: [ComponentOption_Editor] = [
100100
AnyView(
101101
Group {
102102
if let entityId = selectedId {
103-
DirLightEditorView(entityId: entityId, refreshView: refreshView)
103+
DirLightEditorView(entityId: entityId, refreshView: refreshView)
104104
}
105105
}
106106
)
@@ -109,7 +109,7 @@ var availableComponents_Editor: [ComponentOption_Editor] = [
109109
AnyView(
110110
Group {
111111
if let entityId = selectedId {
112-
PointLightEditorView(entityId: entityId, refreshView: refreshView)
112+
PointLightEditorView(entityId: entityId, refreshView: refreshView)
113113
}
114114
}
115115
)
@@ -118,7 +118,7 @@ var availableComponents_Editor: [ComponentOption_Editor] = [
118118
AnyView(
119119
Group {
120120
if let entityId = selectedId {
121-
SpotLightEditorView(entityId: entityId, refreshView: refreshView)
121+
SpotLightEditorView(entityId: entityId, refreshView: refreshView)
122122
}
123123
}
124124
)
@@ -127,7 +127,7 @@ var availableComponents_Editor: [ComponentOption_Editor] = [
127127
AnyView(
128128
Group {
129129
if let entityId = selectedId {
130-
AreaLightEditorView(entityId: entityId, refreshView: refreshView)
130+
AreaLightEditorView(entityId: entityId, refreshView: refreshView)
131131
}
132132
}
133133
)
@@ -372,9 +372,9 @@ func getMaterialBaseColor(entityId: EntityID) -> simd_float4 {
372372
let entityId: EntityID
373373
let asset: Asset?
374374
let refreshView: () -> Void
375-
375+
376376
var body: some View{
377-
377+
378378
}
379379
}
380380
*/

Sources/UntoldEngine/Editor/LogConsoleView.swift

Lines changed: 29 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,10 @@
55
// Created by Harold Serrano on 8/10/25.
66
//
77

8-
import Foundation
98
import Combine
9+
import Foundation
1010
import SwiftUI
1111

12-
1312
public final class LogStore: ObservableObject, LoggerSink {
1413
public static let shared = LogStore()
1514
@Published public private(set) var entries: [LogEvent] = []
@@ -21,15 +20,13 @@ public final class LogStore: ObservableObject, LoggerSink {
2120

2221
public func didLog(_ event: LogEvent) {
2322
DispatchQueue.main.async { [weak self] in
24-
guard let self = self else { return }
23+
guard let self else { return }
2524
self.entries.append(event)
2625
if self.entries.count > self.maxEntries {
2726
self.entries.removeFirst(self.entries.count - self.maxEntries)
2827
}
2928
}
3029
}
31-
32-
3330
}
3431

3532
struct LogConsoleView: View {
@@ -40,9 +37,9 @@ struct LogConsoleView: View {
4037

4138
private func passes(_ e: LogEvent) -> Bool {
4239
(selectedLevel == nil || e.level == selectedLevel!) &&
43-
(search.isEmpty ||
44-
e.message.localizedCaseInsensitiveContains(search) ||
45-
e.category.localizedCaseInsensitiveContains(search))
40+
(search.isEmpty ||
41+
e.message.localizedCaseInsensitiveContains(search) ||
42+
e.category.localizedCaseInsensitiveContains(search))
4643
}
4744

4845
var body: some View {
@@ -64,27 +61,27 @@ struct LogConsoleView: View {
6461

6562
Toggle("Auto‑scroll", isOn: $autoScroll)
6663
.toggleStyle(.checkbox)
67-
/* //Disabling Buttons for now
68-
Spacer()
69-
70-
Button("Copy") {
71-
let text = store.entries.filter(passes).map {
72-
"[\($0.level)] \($0.message)"
73-
}.joined(separator: "\n")
74-
#if os(macOS)
75-
NSPasteboard.general.clearContents()
76-
NSPasteboard.general.setString(text, forType: .string)
77-
#endif
78-
}
79-
80-
Button("Export") {
81-
//exportLog(store.entries.filter(passes))
82-
}
83-
84-
Button("Clear") {
85-
// optional: expose a clear API on Logger/LogStore if you want
86-
}
87-
*/
64+
/* //Disabling Buttons for now
65+
Spacer()
66+
67+
Button("Copy") {
68+
let text = store.entries.filter(passes).map {
69+
"[\($0.level)] \($0.message)"
70+
}.joined(separator: "\n")
71+
#if os(macOS)
72+
NSPasteboard.general.clearContents()
73+
NSPasteboard.general.setString(text, forType: .string)
74+
#endif
75+
}
76+
77+
Button("Export") {
78+
//exportLog(store.entries.filter(passes))
79+
}
80+
81+
Button("Clear") {
82+
// optional: expose a clear API on Logger/LogStore if you want
83+
}
84+
*/
8885
}
8986
.padding(.horizontal, 8)
9087

@@ -125,6 +122,7 @@ struct LogConsoleView: View {
125122
f.dateFormat = "HH:mm:ss.SSS"
126123
return f.string(from: d)
127124
}
125+
128126
private func tag(for level: LogLevel) -> String {
129127
switch level {
130128
case .error: return "ERROR"
@@ -135,6 +133,7 @@ struct LogConsoleView: View {
135133
case .none: return ""
136134
}
137135
}
136+
138137
private func badgeColor(for level: LogLevel) -> Color {
139138
switch level {
140139
case .error: return .red
@@ -158,7 +157,7 @@ private func exportLog(_ entries: [LogEvent]) {
158157
do {
159158
try text.data(using: .utf8)?.write(to: url)
160159
#if os(macOS)
161-
NSWorkspace.shared.activateFileViewerSelecting([url])
160+
NSWorkspace.shared.activateFileViewerSelecting([url])
162161
#endif
163162
} catch {
164163
Logger.logError(message: "Failed to export log: \(error)", category: "Logger")

0 commit comments

Comments
 (0)