Uninstall Mac apps with every file they leave behind, and see why each belongs. Free up space, fine-tune macOS, and set up Terminal.
Swift cache-cleanercleanerclideveloper-toolsdisk-cleanupdisk-spaceduplicate-finderhomebrewliquid-glassmac-cleanermacosmacos-appmacos-golden-gatemacos-tahoemacos-tweaksswiftswiftuiterminal-themesuninstalluninstaller
A one word identifier too common for a name claims nothing
Țugui Dragoș1bee570cbdda
diff --git a/Packages/PeelCore/Sources/PeelCore/Leftovers/LeftoverMatcher.swift b/Packages/PeelCore/Sources/PeelCore/Leftovers/LeftoverMatcher.swiftindex 5385cf01..b7a74920 100644--- a/Packages/PeelCore/Sources/PeelCore/Leftovers/LeftoverMatcher.swift+++ b/Packages/PeelCore/Sources/PeelCore/Leftovers/LeftoverMatcher.swift@@ -283,6 +283,12 @@ extension LeftoverMatcher {return normalizedNames.contains { $0.hasPrefix(candidate.normalized) || candidate.normalized.hasPrefix($0) }}+ /// An identifier without an identifier's shape counts as a name, under the names' rule: one too short or too+ /// common for a name, such as a job labelled `updater`, claims nothing.+ private func unproven(_ reason: MatchReason, _ candidate: Candidate) -> Evidence? {+ Naming.isSignificant(candidate.key) ? Evidence(unproven: reason, for: candidate) : nil+ }+func evidence(for candidate: Candidate) -> Evidence? {let key = candidate.key// Everything an app says about itself (its identifier, what it embeds, the groups it claims)@@ -290,15 +296,15 @@ extension LeftoverMatcher {guard !candidate.isApple || isApplesOwn else { return nil }if key == identifier {- guard Identifier.isValid(key) else { return Evidence(unproven: .bundleIdentifier, for: candidate) }+ guard Identifier.isValid(key) else { return unproven(.bundleIdentifier, candidate) }return Evidence(.bundleIdentifier, .certain, specificity: key.count)}if let embedded = embeddedIdentifiers.first(where: { $0.value == key }) {- guard Identifier.isValid(key) else { return Evidence(unproven: .embeddedBundleIdentifier, for: candidate) }+ guard Identifier.isValid(key) else { return unproven(.embeddedBundleIdentifier, candidate) }return Evidence(.embeddedBundleIdentifier, embedded.sharesVendor ? .certain : .likely, specificity: key.count)}if applicationGroups.contains(key) {- guard Identifier.isGroup(key) else { return Evidence(unproven: .applicationGroup, for: candidate) }+ guard Identifier.isGroup(key) else { return unproven(.applicationGroup, candidate) }return Evidence(.applicationGroup, .certain, specificity: key.count)}guard !candidate.isApple else { return nil }diff --git a/Packages/PeelCore/Tests/PeelCoreTests/LeftoverMatcherTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/LeftoverMatcherTests.swiftindex 7eda8785..9fba17fb 100644--- a/Packages/PeelCore/Tests/PeelCoreTests/LeftoverMatcherTests.swift+++ b/Packages/PeelCore/Tests/PeelCoreTests/LeftoverMatcherTests.swift@@ -348,6 +348,17 @@ struct LeftoverMatcherTests {#expect(match("com.example.game", in: .caches, for: carrier)?.confidence == .certain)}+ /// A one word identifier is held to the rule a name is: a word any folder could be called claims nothing. A job's+ /// label is free text, and one called "updater" is not a claim on every folder of that name.+ @Test func aOneWordIdentifierTooCommonForANameClaimsNothing() {+ let tool = app("com.example.tool", name: "Example Tool", embedded: ["updater", "Helper", "tl"])++ #expect(match("updater", in: .applicationSupport, for: tool) == nil)+ #expect(match("Helper", in: .caches, for: tool) == nil)+ #expect(match("tl", in: .preferences, for: tool) == nil)+ #expect(match("com.example.tool", in: .caches, for: tool)?.confidence == .certain)+ }+/// A real identifier can have two components or a first one longer than a country or a company's short domain:/// Arc is `company.thebrowser.Browser`, Obsidian `md.obsidian`, Notion `notion.id`. A file named exactly by one is/// that app's, as certain as any, and so is one named by an identifier it embeds.