fix: allow rerunning imported projects

This commit is contained in:
muena
2026-09-28 09:17:53 +02:00
parent ec1e2d27e0
commit ec1f9a4e55
3 changed files with 16 additions and 7 deletions

View File

@@ -89,9 +89,14 @@ export function withoutWhitelistedHits<T extends GroupableHit>(hits: T[], whitel
}
/** A later run must not turn an existing Velum placeholder plus adjacent text into a new entity. */
export function withoutPlaceholderHits<T extends { original: string; type: string }>(hits: T[]): T[] {
export function withoutPlaceholderHits<T extends { original: string; type: string }>(
hits: T[], knownPlaceholders: Iterable<string> = [],
): T[] {
const placeholder = /(?<![\p{L}\p{N}])[A-Z][A-Z0-9]*_\d{2,}(?![\p{L}\p{N}])/u;
return hits.filter((hit) => hit.type === "PASSWORT" || !placeholder.test(hit.original));
const known = [...knownPlaceholders].filter(Boolean);
return hits.filter((hit) => hit.type === "PASSWORT" || (
!placeholder.test(hit.original) && !known.some((key) => hit.original.includes(key))
));
}
export function withoutWhitelistedRules<T extends { type: string; value: string }>(