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.

Read a quiet project further before judging its build folders

Țugui Dragoș5de994337db2
diff --git a/Packages/PeelCore/Sources/PeelCore/Developer/ProjectArtifacts.swift b/Packages/PeelCore/Sources/PeelCore/Developer/ProjectArtifacts.swift
index f00ff452..0643dd07 100644
--- a/Packages/PeelCore/Sources/PeelCore/Developer/ProjectArtifacts.swift
+++ b/Packages/PeelCore/Sources/PeelCore/Developer/ProjectArtifacts.swift
@@ -756,7 +756,7 @@ public enum ProjectArtifacts {
static let maximumDepth = 8
static let maximumFolders = 40_000
/// Past this many entries read, a project's last change counts as unknown.
- static let maximumActivitySamples = 2_000
+ static let maximumActivitySamples = 10_000
public struct Scan: Sendable {
public var artifacts: [ProjectArtifact] = []
diff --git a/Packages/PeelCore/Tests/PeelCoreTests/ProjectArtifactsTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/ProjectArtifactsTests.swift
index 3b60b1a6..6bec9032 100644
--- a/Packages/PeelCore/Tests/PeelCoreTests/ProjectArtifactsTests.swift
+++ b/Packages/PeelCore/Tests/PeelCoreTests/ProjectArtifactsTests.swift
@@ -1273,6 +1273,23 @@ struct ProjectArtifactsTests {
#expect(!artifact.isRecommended)
}
+ /// A quiet project of a few thousand files is read to the end, so what a build left deep inside it is suggested.
+ @Test func readsAQuietProjectOfThousandsOfFilesToTheEnd() async throws {
+ let directory = try TemporaryDirectory()
+ try directory.file("lib/pyproject.toml", bytes: 16)
+ try directory.file("lib/lib/core/__pycache__/gate.cpython-313.pyc", bytes: 400_000)
+ for index in 0..<4_500 {
+ try directory.file("lib/lib/core/module\(index).py", bytes: 1)
+ }
+ try age(directory.url, days: 60)
+
+ let cache = try #require(await ProjectArtifacts.scan(roots: [directory.url]).artifacts.first)
+
+ #expect(cache.project.lastPathComponent == "lib")
+ #expect(cache.lastActivityIsCertain)
+ #expect(cache.isRecommended)
+ }
+
/// Work in a hidden file, in `.github`, or in a folder of the person's own that a tool's table also names is
/// work: only the artifacts found and what installed packages bring along are passed by.
@Test func countsWorkInHiddenFilesAndFoldersNamedLikeArtifacts() async throws {