Skip to content

armgit / peel

Public Imported from GitHub
0

Uninstall Mac apps with every file they leave behind, and see why each belongs. Free up space, fine-tune macOS, and set up Terminal.

Put six doc comments back on what they describe

Țugui Dragoș04987da7309f
diff --git a/Packages/PeelCore/Sources/PeelCore/Support/FileSize.swift b/Packages/PeelCore/Sources/PeelCore/Support/FileSize.swift
index 18cef65d..6c8996e3 100644
--- a/Packages/PeelCore/Sources/PeelCore/Support/FileSize.swift
+++ b/Packages/PeelCore/Sources/PeelCore/Support/FileSize.swift
@@ -449,7 +449,6 @@ private enum Walks {
}
}
-/// One answer, written by a thread that may never come back and read by everyone who is waiting for it.
extension QualityOfService {
/// What a thread of its own takes to run at the priority of the task that asked.
init(_ priority: TaskPriority) {
@@ -462,6 +461,7 @@ extension QualityOfService {
}
}
+/// One answer, written by a thread that may never come back and read by everyone who is waiting for it.
private final class Answer: Sendable {
private struct State {
var contents: FolderContents?
diff --git a/Packages/PeelCore/Tests/PeelCoreTests/CommandLineTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/CommandLineTests.swift
index 332489f3..1c4be586 100644
--- a/Packages/PeelCore/Tests/PeelCoreTests/CommandLineTests.swift
+++ b/Packages/PeelCore/Tests/PeelCoreTests/CommandLineTests.swift
@@ -521,7 +521,6 @@ struct CommandLineTests {
#expect(records[0]["isRecommended"] as? Bool == false)
}
- /// `peel leftovers --json` names the folders macOS kept Peel out of, where the app may have left more.
@Test func aPathReadsTheSameWhetherOrNotAnythingIsThere() throws {
let directory = try TemporaryDirectory()
let there = try directory.file("there.txt")
@@ -588,6 +587,7 @@ struct CommandLineTests {
#expect(collected.notes.contains(folder.path(percentEncoded: false)))
}
+ /// `peel leftovers --json` names the folders macOS kept Peel out of, where the app may have left more.
@Test func theLeftoversReportSaysWhereItCouldNotLook() throws {
let app = InstalledApp(url: URL(filePath: "/Applications/Editor.app", directoryHint: .isDirectory), bundleIdentifier: "com.example.editor", name: "Editor")
let unread = SearchLocation(kind: .containers, url: URL(filePath: "/Users/me/Library/Containers", directoryHint: .isDirectory))
diff --git a/Packages/PeelCore/Tests/PeelCoreTests/FileSearchTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/FileSearchTests.swift
index 95da0410..08f0fbf1 100644
--- a/Packages/PeelCore/Tests/PeelCoreTests/FileSearchTests.swift
+++ b/Packages/PeelCore/Tests/PeelCoreTests/FileSearchTests.swift
@@ -528,8 +528,6 @@ struct FileSearchTests {
#expect(held["Movies"] == .some(nil))
}
- /// The guard is asked only about the files that can make the list: the largest first, and no further once
- /// the list is full and one more file shows it had to be cut.
@Test func neverAsksTheGuardAboutWhatMacOSKeepsInItsOwnFolders() throws {
let macOSsOwn = [
"/System/Library/CoreServices/SystemVersion.plist", "/usr/bin/true", "/bin/ls", "/sbin/mount",
@@ -550,6 +548,8 @@ struct FileSearchTests {
}
}
+ /// The guard is asked only about the files that can make the list: the largest first, and no further once
+ /// the list is full and one more file shows it had to be cut.
@Test func asksTheGuardOnlyAboutFilesThatCanMakeTheList() throws {
let directory = try TemporaryDirectory()
let home = directory.url.appending(path: "home", directoryHint: .isDirectory)
diff --git a/Packages/PeelCore/Tests/PeelCoreTests/PathPatternTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/PathPatternTests.swift
index acb34de5..a711b441 100644
--- a/Packages/PeelCore/Tests/PeelCoreTests/PathPatternTests.swift
+++ b/Packages/PeelCore/Tests/PeelCoreTests/PathPatternTests.swift
@@ -76,7 +76,6 @@ struct PathPatternTests {
#expect(found("~/Library/Frameworks/example.framework/versions/current", .cask) == ["Example.framework/Versions/Current"])
}
- /// A bracket in a real name is not a character class: `App [Beta]` has to find itself.
@Test func aNameFoundWithoutOpeningIsTheKernelsName() throws {
let directory = try TemporaryDirectory()
let file = try directory.file("Images/Disk.dmg", bytes: 16)
@@ -97,6 +96,7 @@ struct PathPatternTests {
#expect(PathPattern.canonicalWithoutOpening(absent) == absent)
}
+ /// A bracket in a real name is not a character class: `App [Beta]` has to find itself.
@Test func findsAFolderWhoseNameHoldsABracket() throws {
let directory = try TemporaryDirectory()
try directory.directory("Library/Caches/App [Beta]")
diff --git a/Packages/PeelCore/Tests/PeelCoreTests/TrashServiceTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/TrashServiceTests.swift
index 1bd9660a..aea04443 100644
--- a/Packages/PeelCore/Tests/PeelCoreTests/TrashServiceTests.swift
+++ b/Packages/PeelCore/Tests/PeelCoreTests/TrashServiceTests.swift
@@ -328,7 +328,6 @@ struct TrashServiceTests {
#expect(count.value == 2)
}
- /// A job stopped before a move that then fails is a job left stopped with its file still in place.
private func serviceEnding(
_ agent: Process, in directory: borrowing TemporaryDirectory
) throws -> TrashService {
@@ -381,6 +380,7 @@ struct TrashServiceTests {
#expect(result.trashed.first { $0.originalURL == plist }?.stoppedJob == "com.example.agent")
}
+ /// A job stopped before a move that then fails is a job left stopped with its file still in place.
@Test func stopsAJobOnlyOnceItsFileHasMoved() async throws {
let directory = try TemporaryDirectory()
let moved = try launchdPlist("home/Library/LaunchAgents/com.example.moved.plist", in: directory)
diff --git a/Packages/PeelCore/Tests/PeelCoreTests/TweakTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/TweakTests.swift
index d4341622..31f6c1c0 100644
--- a/Packages/PeelCore/Tests/PeelCoreTests/TweakTests.swift
+++ b/Packages/PeelCore/Tests/PeelCoreTests/TweakTests.swift
@@ -16,10 +16,6 @@ struct TweakTests {
}
}
- /// AppKit and HIToolbox read their keys once, when an app starts, so apps already open keep the old value.
- /// The row says so rather than asking for a log out, which would work but is not needed.
- /// Apple documents only a few of these keys; the rest are known from use alone, so a release can rename or ignore
- /// one without a word. Each tweak says which it is, and a documented one names Apple's page.
@Test func aGlobalKeyAProfileForcesReadsAsWhatTheProfileForces() throws {
let directory = try TemporaryDirectory()
let forced = directory.url.appending(path: "forced.plist")
@@ -36,6 +32,10 @@ struct TweakTests {
#expect(other == nil)
}
+ /// AppKit and HIToolbox read their keys once, when an app starts, so apps already open keep the old value.
+ /// The row says so rather than asking for a log out, which would work but is not needed.
+ /// Apple documents only a few of these keys; the rest are known from use alone, so a release can rename or ignore
+ /// one without a word. Each tweak says which it is, and a documented one names Apple's page.
@Test func everyTweakSaysWhereAppleDocumentsIt() {
var documented: Set<String> = []
for tweak in TweakCatalog.all {