diff --git a/tools/audit-project.js b/tools/audit-project.js index 0696cc8..8ccb473 100644 --- a/tools/audit-project.js +++ b/tools/audit-project.js @@ -18,6 +18,8 @@ const ROOT = path.resolve(__dirname, '..'); // tools/ 是检查器自身,内部必然包含 importObject 等模式字符串, // 当成业务代码审计只会产生假阳性;.zcode/ 是工具链运行产物。 const IGNORE_DIRS = new Set(['.git', 'node_modules', 'unpackage', '.hbuilderx', '.trae', 'git', 'tools', '.zcode']); +// P2-1: 已被 .gitignore 忽略的构建产物不参与编码审计(hx_page.html 的 UTF-8 BOM 是 HBuilderX 生成器行为,非源码问题)。 +const IGNORE_FILES = new Set(['hx_page.html']); const SOURCE_EXT = new Set(['.vue', '.js', '.ts', '.json', '.scss', '.css', '.md', '.html']); const JSON_OUT = process.argv.includes('--json'); @@ -50,6 +52,7 @@ function walk(dir, out = []) { if (IGNORE_DIRS.has(e.name)) continue; walk(path.join(dir, e.name), out); } else if (e.isFile()) { + if (IGNORE_FILES.has(e.name)) continue; out.push(path.join(dir, e.name)); } }