From edb58b2fea87b5f78c8334b96df66d30ff382551 Mon Sep 17 00:00:00 2001 From: David Abutbul Date: Mon, 16 Feb 2026 16:23:44 +0200 Subject: [PATCH] Fix regex in extractSkillName function and simplify error handling in suppression config tests --- .../openclaw-audit-watchdog/scripts/render_report.mjs | 2 +- .../test/suppression_config.test.mjs | 10 +++------- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/skills/openclaw-audit-watchdog/scripts/render_report.mjs b/skills/openclaw-audit-watchdog/scripts/render_report.mjs index f9bda0f..84f9c19 100755 --- a/skills/openclaw-audit-watchdog/scripts/render_report.mjs +++ b/skills/openclaw-audit-watchdog/scripts/render_report.mjs @@ -47,7 +47,7 @@ function extractSkillName(finding) { // Attempt to extract from path (e.g., "skills/my-skill/...") if (finding.path && typeof finding.path === "string") { - const pathMatch = finding.path.match(/skills\/([^\/]+)/); + const pathMatch = finding.path.match(/skills\/([^/]+)/); if (pathMatch) return pathMatch[1]; } diff --git a/skills/openclaw-audit-watchdog/test/suppression_config.test.mjs b/skills/openclaw-audit-watchdog/test/suppression_config.test.mjs index b042fa1..be3c711 100755 --- a/skills/openclaw-audit-watchdog/test/suppression_config.test.mjs +++ b/skills/openclaw-audit-watchdog/test/suppression_config.test.mjs @@ -17,11 +17,8 @@ import fs from "node:fs/promises"; import path from "node:path"; import os from "node:os"; -import { fileURLToPath } from "node:url"; import { loadSuppressionConfig } from "../scripts/load_suppression_config.mjs"; -const __dirname = path.dirname(fileURLToPath(import.meta.url)); - let passCount = 0; let failCount = 0; @@ -46,7 +43,7 @@ async function withTempFile(content) { cleanup: async () => { try { await fs.rm(tmpDir, { recursive: true, force: true }); - } catch (err) { + } catch { // Ignore cleanup errors } }, @@ -256,14 +253,13 @@ async function testFileNotFoundGracefulFallback() { try { await withEnv("OPENCLAW_AUDIT_CONFIG", undefined, async () => { const nonExistentPath1 = path.join(os.homedir(), ".openclaw", "non-existent-12345.json"); - const nonExistentPath2 = ".clawsec/non-existent-12345.json"; - // Ensure neither path exists + // Ensure path does not exist try { await fs.access(nonExistentPath1); fail(testName, "Test precondition failed: primary path should not exist"); return; - } catch (err) { + } catch { // Expected - file should not exist }