Refresh HiveGrid Cloud reference snapshot
This commit is contained in:
1 parent
5e99e14772
commit
7f88026f79
5955 files changed
+1177325
-188362
No files matched your search
+17
-12
@@ -41,6 +41,7 @@ export const impersonationScopeImpersonationScopeInventoryPatterns = [
|
||||
{ id: "session-actor", pattern: /\b(?:session actor|actor user|fromUser|from user|impersonatingFromUserId|toUser|currentUser|userSession)\b/gi },
|
||||
{ id: "ui-marker", pattern: /\b(?:banner|badge|marker|indicator|toast|impersonating session|session notice)\b/gi },
|
||||
];
|
||||
const INVENTORY_READ_BATCH_SIZE = 32;
|
||||
|
||||
export const gates = [
|
||||
{ id: "typecheck", command: "pnpm", args: ["run", "typecheck"] },
|
||||
@@ -168,19 +169,23 @@ export async function runImpersonationScopeImpersonationScopeInventory(root = re
|
||||
const files = (await Promise.all(existingRoots.map((rootRelativePath) => collectFiles(root, rootRelativePath)))).flat();
|
||||
const counts = new Map(impersonationScopeImpersonationScopeInventoryPatterns.map(({ id }) => [id, 0]));
|
||||
const matches = [];
|
||||
for (const file of files) {
|
||||
const relativeFile = path.relative(root, file).split(path.sep).join("/");
|
||||
const lines = (await readFile(file, "utf8")).split(/\r?\n/);
|
||||
lines.forEach((line, index) => {
|
||||
for (const { id, pattern } of impersonationScopeImpersonationScopeInventoryPatterns) {
|
||||
pattern.lastIndex = 0;
|
||||
const found = line.match(pattern);
|
||||
if (!found) continue;
|
||||
counts.set(id, (counts.get(id) ?? 0) + found.length);
|
||||
for (const match of found) {
|
||||
matches.push(`${relativeFile}:${index + 1}: [${id}] ${match}: ${line.trim()}`);
|
||||
for (let batchStart = 0; batchStart < files.length; batchStart += INVENTORY_READ_BATCH_SIZE) {
|
||||
const batch = files.slice(batchStart, batchStart + INVENTORY_READ_BATCH_SIZE);
|
||||
const contents = await Promise.all(batch.map((file) => readFile(file, "utf8")));
|
||||
batch.forEach((file, fileIndex) => {
|
||||
const relativeFile = path.relative(root, file).split(path.sep).join("/");
|
||||
const lines = contents[fileIndex].split(/\r?\n/);
|
||||
lines.forEach((line, index) => {
|
||||
for (const { id, pattern } of impersonationScopeImpersonationScopeInventoryPatterns) {
|
||||
pattern.lastIndex = 0;
|
||||
const found = line.match(pattern);
|
||||
if (!found) continue;
|
||||
counts.set(id, (counts.get(id) ?? 0) + found.length);
|
||||
for (const match of found) {
|
||||
matches.push(`${relativeFile}:${index + 1}: [${id}] ${match}: ${line.trim()}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
return { roots: existingRoots, missingRoots, filesScanned: files.length, counts: Object.fromEntries(counts.entries()), totalMatches: matches.length, matches };
|
||||
|
||||
Reference in new issue
Block a user