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.

Developer lists SonarScanner's cache

Țugui Dragoșd1e0982c771b
diff --git a/Packages/PeelCore/Sources/PeelCore/Developer/DeveloperCaches.swift b/Packages/PeelCore/Sources/PeelCore/Developer/DeveloperCaches.swift
index ee5a9e1b..80fe829c 100644
--- a/Packages/PeelCore/Sources/PeelCore/Developer/DeveloperCaches.swift
+++ b/Packages/PeelCore/Sources/PeelCore/Developer/DeveloperCaches.swift
@@ -766,6 +766,10 @@ public enum DeveloperCaches {
),
]),
// Build systems and media
+ // Only the scanner's cache: `ssl` beside it holds the client certificates the scanner signs in with.
+ Definition(id: "sonar", name: "SonarScanner", systemImage: "hammer", appBundleIdentifiers: [], folders: [
+ Folder(".sonar/cache", .downloads, source: "https://github.com/SonarSource/sonar-scanner-java-library/blob/master/lib/src/main/java/org/sonarsource/scanner/lib/ScannerEngineBootstrapper.java#L137"),
+ ]),
Definition(id: "ccache", name: "ccache", systemImage: "gearshape.2", appBundleIdentifiers: [], folders: [
Folder("Library/Caches/ccache", .buildData, source: "https://github.com/ccache/ccache/blob/master/doc/manual.adoc#L575-L577"),
// A legacy `~/.ccache` also holds `ccache.conf` (https://ccache.dev/manual/latest.html), so only
diff --git a/Packages/PeelCore/Tests/PeelCoreTests/DeveloperCachesTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/DeveloperCachesTests.swift
index 0d7ca6d0..b52bde9d 100644
--- a/Packages/PeelCore/Tests/PeelCoreTests/DeveloperCachesTests.swift
+++ b/Packages/PeelCore/Tests/PeelCoreTests/DeveloperCachesTests.swift
@@ -270,8 +270,8 @@ struct DeveloperCachesTests {
// minikube keeps its clusters' keys and the images a person added; Vagrant its machine index and key;
// Jan its chat history; Ollama a copy of its app while it updates.
".minikube", ".minikube/cache/images", ".vagrant.d", "Library/Application Support/Jan/data", "Library/Caches/ollama",
- // Unity keeps its licenses beside its caches.
- "Library/Unity",
+ // Unity keeps its licenses beside its caches; SonarScanner the client certificates it signs in with.
+ "Library/Unity", ".sonar",
]
// CocoaPods' spec repositories hold the ones a person added, which can carry unpushed work: only the CDN copy
// of the public index, `trunk`, is a cache. nvm's, pyenv's, rbenv's and rustup's folders hold every version
@@ -885,6 +885,17 @@ struct DeveloperCachesTests {
#expect(locations.first?.kind == .cache)
}
+ @Test func offersTheSonarScannersCacheAndNeverItsCertificates() async throws {
+ let directory = try TemporaryDirectory()
+ try directory.file(".sonar/cache/0f2e/sonar-scanner-engine-shaded-10.jar", bytes: 400_000)
+ try directory.file(".sonar/ssl/keystore.p12", bytes: 4_096)
+ let sonar = DeveloperCaches.definitions.filter { $0.id == "sonar" }
+
+ let locations = await DeveloperCaches.scan(sonar, homeDirectory: directory.url).flatMap(\.locations)
+
+ #expect(locations.map(\.url.lastPathComponent) == ["cache"])
+ }
+
/// virtualenvwrapper keeps the user's hook scripts beside the environments in `~/.virtualenvs`, so only the
/// environments are offered, and a link among them is left where it is, never followed.
@Test func offersVirtualenvwrappersEnvironmentsAndNotItsHooks() async throws {