mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-10 05:12:14 +00:00
style: satisfy v1.34.1 format gate
This commit is contained in:
1 parent
b0a94b3423
commit
75aa850eae
10 files changed
+71
-59
No files matched your search
@@ -25,7 +25,13 @@ const REQUIRED_FIELDS = [
|
||||
"Confidence",
|
||||
"Unresolved",
|
||||
];
|
||||
const ALLOWED_STATUS = new Set(["confirmed", "suspected", "blocked", "cleared", "refuted"]);
|
||||
const ALLOWED_STATUS = new Set([
|
||||
"confirmed",
|
||||
"suspected",
|
||||
"blocked",
|
||||
"cleared",
|
||||
"refuted",
|
||||
]);
|
||||
const ALLOWED_SEVERITY = new Set(["critical", "high", "medium", "low", "info"]);
|
||||
const ALLOWED_CONFIDENCE = new Set(["high", "medium", "low"]);
|
||||
const REQUIRED_SOURCES = ["research:", "correctness:", "live:", "performance:"];
|
||||
@@ -41,7 +47,10 @@ const PRIVACY_PATTERNS = [
|
||||
name: "email address",
|
||||
pattern: /\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}\b/i,
|
||||
},
|
||||
{ name: "authorization credential", pattern: /\bBearer\s+[A-Za-z0-9._~+/=-]+/i },
|
||||
{
|
||||
name: "authorization credential",
|
||||
pattern: /\bBearer\s+[A-Za-z0-9._~+/=-]+/i,
|
||||
},
|
||||
{
|
||||
name: "secret assignment",
|
||||
pattern:
|
||||
@@ -90,7 +99,8 @@ try {
|
||||
}
|
||||
|
||||
for (const check of PRIVACY_PATTERNS) {
|
||||
if (check.pattern.test(source)) errors.push(`privacy-dangerous ${check.name} detected`);
|
||||
if (check.pattern.test(source))
|
||||
errors.push(`privacy-dangerous ${check.name} detected`);
|
||||
}
|
||||
|
||||
const headingPattern = /^## (AUD-\d{3}) — (.+)$/gm;
|
||||
@@ -149,7 +159,8 @@ for (let index = 0; index < headings.length; index += 1) {
|
||||
errors.push(`${id}: ${status} findings must set Unresolved to no`);
|
||||
}
|
||||
if (sourceField) {
|
||||
if (sourceRecords.has(sourceField)) errors.push(`${id}: duplicate Source record`);
|
||||
if (sourceRecords.has(sourceField))
|
||||
errors.push(`${id}: duplicate Source record`);
|
||||
sourceRecords.add(sourceField);
|
||||
}
|
||||
|
||||
@@ -164,7 +175,9 @@ for (let index = 0; index < records.length; index += 1) {
|
||||
}
|
||||
|
||||
for (const prefix of REQUIRED_SOURCES) {
|
||||
if (!records.some((record) => record.fields.get("Source")?.includes(prefix))) {
|
||||
if (
|
||||
!records.some((record) => record.fields.get("Source")?.includes(prefix))
|
||||
) {
|
||||
errors.push(`missing source family ${prefix}`);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,7 +34,9 @@ function fail(message) {
|
||||
}
|
||||
|
||||
if (!fixtureMode) {
|
||||
fail("refusing to run without --fixture; live and production probes are unsupported");
|
||||
fail(
|
||||
"refusing to run without --fixture; live and production probes are unsupported",
|
||||
);
|
||||
}
|
||||
if (process.env.NODE_ENV === "production") {
|
||||
fail("refusing to run with NODE_ENV=production");
|
||||
@@ -43,7 +45,9 @@ if (!outputPath) {
|
||||
fail("--output <markdown-path> is required");
|
||||
}
|
||||
if (args.some((arg) => /^(--url|--host|--database|--token|--live)/.test(arg))) {
|
||||
fail("network, database, credential, and live-target arguments are unsupported");
|
||||
fail(
|
||||
"network, database, credential, and live-target arguments are unsupported",
|
||||
);
|
||||
}
|
||||
|
||||
const startedAt = performance.now();
|
||||
@@ -63,7 +67,9 @@ function seededNumber(index, salt) {
|
||||
}
|
||||
|
||||
function percentile(sorted, fraction) {
|
||||
return sorted[Math.min(sorted.length - 1, Math.ceil(sorted.length * fraction) - 1)];
|
||||
return sorted[
|
||||
Math.min(sorted.length - 1, Math.ceil(sorted.length * fraction) - 1)
|
||||
];
|
||||
}
|
||||
|
||||
function formatMs(value) {
|
||||
@@ -94,7 +100,10 @@ function benchmark(name, operation) {
|
||||
}
|
||||
const elapsed = warm.map((sample) => sample.elapsedMs).sort((a, b) => a - b);
|
||||
const heaps = warm.map((sample) => sample.heapDeltaBytes);
|
||||
const checksums = new Set([cold.result.checksum, ...warm.map((sample) => sample.result.checksum)]);
|
||||
const checksums = new Set([
|
||||
cold.result.checksum,
|
||||
...warm.map((sample) => sample.result.checksum),
|
||||
]);
|
||||
if (checksums.size !== 1) {
|
||||
throw new Error(`${name} fixture produced a non-deterministic checksum`);
|
||||
}
|
||||
@@ -213,7 +222,8 @@ function healthScoreFixture() {
|
||||
domainCounts[row.domain] += 1;
|
||||
}
|
||||
let checksum = 0;
|
||||
for (const row of dailyCanonical.values()) checksum = (checksum + row.value) >>> 0;
|
||||
for (const row of dailyCanonical.values())
|
||||
checksum = (checksum + row.value) >>> 0;
|
||||
for (let domain = 0; domain < domainTotals.length; domain += 1) {
|
||||
const normalized = Math.round(domainTotals[domain] / domainCounts[domain]);
|
||||
checksum = (checksum * 31 + normalized) >>> 0;
|
||||
|
||||
Reference in new issue
Block a user