style: swiftformat pass — drift from the format gate
CI / ci (push) Canceled after 0s
CI / ci (push) Canceled after 0s
Whole-tree swiftformat/swiftlint run during #136 flagged 9 files drifted (/// doc markers on private members, one force-unwrap to #require). Comment- and lint-only, no code change.
This commit is contained in:
1 parent
5ad605eb3c
commit
a4ea914690
9 files changed
+15
-24
No files matched your search
@@ -75,8 +75,7 @@ nonisolated enum LearningsIndex {
|
|||||||
) else { return [] }
|
) else { return [] }
|
||||||
var groups: [Group] = []
|
var groups: [Group] = []
|
||||||
for dir in typeDirs.sorted(by: { $0.lastPathComponent < $1.lastPathComponent }) {
|
for dir in typeDirs.sorted(by: { $0.lastPathComponent < $1.lastPathComponent }) {
|
||||||
guard isPlainDirectory(dir), !dir.lastPathComponent.hasPrefix(".") else { continue }
|
guard isPlainDirectory(dir), !dir.lastPathComponent.hasPrefix("."), let files = try? FileManager.default.contentsOfDirectory(at: dir, includingPropertiesForKeys: nil)
|
||||||
guard let files = try? FileManager.default.contentsOfDirectory(at: dir, includingPropertiesForKeys: nil)
|
|
||||||
else { continue }
|
else { continue }
|
||||||
// #27: the pass clock feeds the decay verdict — clocked dirs
|
// #27: the pass clock feeds the decay verdict — clocked dirs
|
||||||
// carry their count, foreign dirs nil (no verdict; Entry's audit).
|
// carry their count, foreign dirs nil (no verdict; Entry's audit).
|
||||||
|
|||||||
@@ -728,8 +728,8 @@ extension MentorSessionModel {
|
|||||||
guard method == "session/update",
|
guard method == "session/update",
|
||||||
let params,
|
let params,
|
||||||
let sid = params.objectValue?["sessionId"]?.stringValue,
|
let sid = params.objectValue?["sessionId"]?.stringValue,
|
||||||
transcripts[sid] != nil else { return }
|
transcripts[sid] != nil,
|
||||||
guard let update = params.objectValue?["update"]?.objectValue else { return }
|
let update = params.objectValue?["update"]?.objectValue else { return }
|
||||||
let kind = update["sessionUpdate"]?.stringValue ?? "unknown"
|
let kind = update["sessionUpdate"]?.stringValue ?? "unknown"
|
||||||
let replaying = sid == replayingSessionId
|
let replaying = sid == replayingSessionId
|
||||||
switch kind {
|
switch kind {
|
||||||
|
|||||||
@@ -678,11 +678,7 @@ extension OutlineEditorView {
|
|||||||
private func endDrag(at point: CGPoint?, frames: [UUID: CGRect]?) {
|
private func endDrag(at point: CGPoint?, frames: [UUID: CGRect]?) {
|
||||||
let info = drag
|
let info = drag
|
||||||
drag = nil
|
drag = nil
|
||||||
guard let point, let info, let frames else { return }
|
guard let point, let info, let frames, let target = OutlinePresenter.hitTestDrop(point: point, rows: materializedRows(frames: frames)), OutlinePresenter.applyDrop(target, moving: info.moving, in: &nodes) else { return }
|
||||||
guard let target = OutlinePresenter.hitTestDrop(point: point, rows: materializedRows(frames: frames)) else {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
guard OutlinePresenter.applyDrop(target, moving: info.moving, in: &nodes) else { return }
|
|
||||||
selectionAnchor = info.moving.first
|
selectionAnchor = info.moving.first
|
||||||
focusedID = info.moving.last
|
focusedID = info.moving.last
|
||||||
pendingCaret = nil
|
pendingCaret = nil
|
||||||
|
|||||||
@@ -77,8 +77,8 @@ nonisolated struct Post: Identifiable, Equatable {
|
|||||||
for projectDir in projects.sorted(by: { $0.lastPathComponent < $1.lastPathComponent }) {
|
for projectDir in projects.sorted(by: { $0.lastPathComponent < $1.lastPathComponent }) {
|
||||||
let values = try? projectDir.resourceValues(forKeys: [.isDirectoryKey, .isSymbolicLinkKey])
|
let values = try? projectDir.resourceValues(forKeys: [.isDirectoryKey, .isSymbolicLinkKey])
|
||||||
guard values?.isDirectory ?? false, !(values?.isSymbolicLink ?? false),
|
guard values?.isDirectory ?? false, !(values?.isSymbolicLink ?? false),
|
||||||
!projectDir.lastPathComponent.hasPrefix(".") else { continue }
|
!projectDir.lastPathComponent.hasPrefix("."),
|
||||||
guard let entries = try? FileManager.default.contentsOfDirectory(
|
let entries = try? FileManager.default.contentsOfDirectory(
|
||||||
at: projectDir,
|
at: projectDir,
|
||||||
includingPropertiesForKeys: [.isDirectoryKey, .isSymbolicLinkKey],
|
includingPropertiesForKeys: [.isDirectoryKey, .isSymbolicLinkKey],
|
||||||
) else { continue }
|
) else { continue }
|
||||||
@@ -87,8 +87,7 @@ nonisolated struct Post: Identifiable, Equatable {
|
|||||||
guard pieceValues?.isDirectory ?? false, !(pieceValues?.isSymbolicLink ?? false),
|
guard pieceValues?.isDirectory ?? false, !(pieceValues?.isSymbolicLink ?? false),
|
||||||
!dir.lastPathComponent.hasPrefix(".") else { continue }
|
!dir.lastPathComponent.hasPrefix(".") else { continue }
|
||||||
let fileURL = dir.appendingPathComponent("post.md")
|
let fileURL = dir.appendingPathComponent("post.md")
|
||||||
guard let text = try? String(contentsOf: fileURL, encoding: .utf8) else { continue }
|
guard let text = try? String(contentsOf: fileURL, encoding: .utf8), seen.insert(dir.lastPathComponent).inserted else { continue }
|
||||||
guard seen.insert(dir.lastPathComponent).inserted else { continue }
|
|
||||||
let frontmatter = frontmatter(of: text)
|
let frontmatter = frontmatter(of: text)
|
||||||
posts.append(
|
posts.append(
|
||||||
Post(
|
Post(
|
||||||
|
|||||||
@@ -682,9 +682,9 @@ nonisolated extension PostStore {
|
|||||||
}
|
}
|
||||||
try FileManager.default.createDirectory(at: research, withIntermediateDirectories: true)
|
try FileManager.default.createDirectory(at: research, withIntermediateDirectories: true)
|
||||||
let day = FixCardStore.formatted(Date(), "yyyyMMdd")
|
let day = FixCardStore.formatted(Date(), "yyyyMMdd")
|
||||||
/// Flat single-line structural fields (Learning-file precedent): a
|
// Flat single-line structural fields (Learning-file precedent): a
|
||||||
/// newline in a hostile title/url must not break the heading or the
|
// newline in a hostile title/url must not break the heading or the
|
||||||
/// frontmatter shape. Note/quote stay verbatim — they are content.
|
// frontmatter shape. Note/quote stay verbatim — they are content.
|
||||||
func flat(_ value: String) -> String {
|
func flat(_ value: String) -> String {
|
||||||
value.components(separatedBy: .newlines).joined(separator: " ")
|
value.components(separatedBy: .newlines).joined(separator: " ")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -603,8 +603,7 @@ final class PostsModel {
|
|||||||
/// main actor already; no re-hop needed.
|
/// main actor already; no re-hop needed.
|
||||||
private func startExternalWatch(url: URL) {
|
private func startExternalWatch(url: URL) {
|
||||||
externalWatcher.onEvent = { [weak self] in
|
externalWatcher.onEvent = { [weak self] in
|
||||||
guard let self, let session = externalSession else { return }
|
guard let self, let session = externalSession, let disk = try? String(contentsOf: url, encoding: .utf8) else { return }
|
||||||
guard let disk = try? String(contentsOf: url, encoding: .utf8) else { return }
|
|
||||||
session.diskDidChange(diskText: disk)
|
session.diskDidChange(diskText: disk)
|
||||||
}
|
}
|
||||||
externalWatcher.start(urls: [url.deletingLastPathComponent()])
|
externalWatcher.start(urls: [url.deletingLastPathComponent()])
|
||||||
|
|||||||
@@ -88,8 +88,7 @@ nonisolated enum ProseList {
|
|||||||
guard buffer.length > 0 else { return nil }
|
guard buffer.length > 0 else { return nil }
|
||||||
let scanned = lines(in: text)
|
let scanned = lines(in: text)
|
||||||
let caretLoc = min(max(0, caret), buffer.length - 1)
|
let caretLoc = min(max(0, caret), buffer.length - 1)
|
||||||
guard let idx = scanned.firstIndex(where: { NSLocationInRange(caretLoc, $0.range) }) else { return nil }
|
guard let idx = scanned.firstIndex(where: { NSLocationInRange(caretLoc, $0.range) }), scanned[idx].isList else { return nil }
|
||||||
guard scanned[idx].isList else { return nil }
|
|
||||||
let indent = scanned[idx].indent
|
let indent = scanned[idx].indent
|
||||||
let bounds = blockBounds(scanned, from: idx, indent: indent)
|
let bounds = blockBounds(scanned, from: idx, indent: indent)
|
||||||
let blockEnd = scanned[bounds.end].end
|
let blockEnd = scanned[bounds.end].end
|
||||||
@@ -154,8 +153,7 @@ nonisolated extension ProseList {
|
|||||||
/// minus our indent. No previous sibling → nil (boundary no-op).
|
/// minus our indent. No previous sibling → nil (boundary no-op).
|
||||||
static func indent(_ item: Item, caret: Int, in text: String) -> Edit? {
|
static func indent(_ item: Item, caret: Int, in text: String) -> Edit? {
|
||||||
let scanned = lines(in: text)
|
let scanned = lines(in: text)
|
||||||
guard let idx = lineIndex(of: item.markerLine.location, in: scanned) else { return nil }
|
guard let idx = lineIndex(of: item.markerLine.location, in: scanned), let sibIdx = adjacentSiblingLine(scanned, from: idx, through: idx, indent: item.indent, direction: -1) else { return nil }
|
||||||
guard let sibIdx = adjacentSiblingLine(scanned, from: idx, through: idx, indent: item.indent, direction: -1) else { return nil }
|
|
||||||
let delta = contentColumn(scanned[sibIdx].text) - item.indent
|
let delta = contentColumn(scanned[sibIdx].text) - item.indent
|
||||||
guard delta > 0 else { return nil }
|
guard delta > 0 else { return nil }
|
||||||
let body = blockBody(text, item.block)
|
let body = blockBody(text, item.block)
|
||||||
|
|||||||
@@ -435,7 +435,7 @@ nonisolated enum ProsePresenter {
|
|||||||
static let inlineSyntax: Set<Character> = ["*", "_", "`", "[", "]", "(", ")", "!", "<", ">"]
|
static let inlineSyntax: Set<Character> = ["*", "_", "`", "[", "]", "(", ")", "!", "<", ">"]
|
||||||
}
|
}
|
||||||
|
|
||||||
nonisolated extension Range where Bound == String.Index {
|
nonisolated extension Range<String.Index> {
|
||||||
func utf16Range(in base: String) -> Range<Int> {
|
func utf16Range(in base: String) -> Range<Int> {
|
||||||
let lo = base.utf16.distance(from: base.utf16.startIndex, to: lowerBound.samePosition(in: base.utf16)!)
|
let lo = base.utf16.distance(from: base.utf16.startIndex, to: lowerBound.samePosition(in: base.utf16)!)
|
||||||
let hi = base.utf16.distance(from: base.utf16.startIndex, to: upperBound.samePosition(in: base.utf16)!)
|
let hi = base.utf16.distance(from: base.utf16.startIndex, to: upperBound.samePosition(in: base.utf16)!)
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ struct ImportExternalTests {
|
|||||||
// A UTF-16 encoded file: String(contentsOf: .utf8) fails → nil.
|
// A UTF-16 encoded file: String(contentsOf: .utf8) fails → nil.
|
||||||
let ext = FileManager.default.temporaryDirectory
|
let ext = FileManager.default.temporaryDirectory
|
||||||
.appendingPathComponent("museion-ext-\(UUID().uuidString)-utf16.md")
|
.appendingPathComponent("museion-ext-\(UUID().uuidString)-utf16.md")
|
||||||
let data = "# Title\n\nBody.".data(using: .utf16)!
|
let data = try #require("# Title\n\nBody.".data(using: .utf16))
|
||||||
try data.write(to: ext)
|
try data.write(to: ext)
|
||||||
defer { try? FileManager.default.removeItem(at: ext) }
|
defer { try? FileManager.default.removeItem(at: ext) }
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user