feat(dacli): 迁移 BS-32 decimal 检查 (word-boundary 防 false positive)

This commit is contained in:
Claude committed 2026-06-14 19:16:59 +08:00
1 parent f01eb5f4aa
commit f7deff05bb
1 file changed
+18
+18
View File
@@ -87,4 +87,22 @@ export function checkBs31(formDataRaw: unknown): BlindspotIssue[] {
}
})
return issues
}
const MONEY_KEYWORDS = ['price', 'amount', 'money', 'quantity', 'sum', 'total', 'fee', 'cost', 'score', 'qty']
const MONEY_REGEX = new RegExp(`\\b(${MONEY_KEYWORDS.join('|')})\\b`, 'i')
export function checkBs32(formDataRaw: unknown): BlindspotIssue[] {
const issues: BlindspotIssue[] = []
const fields = extractFields(safeParse(formDataRaw))
if (!fields) return issues
fields.forEach((f, i) => {
const ff = f as { __config__?: { jnpfKey?: string }; __vModel__?: string }
const vmodel = ff.__vModel__ || ''
const key = ff.__config__?.jnpfKey || ''
if (MONEY_REGEX.test(vmodel) && !['inputNumber', 'numInput', 'calculate'].includes(key)) {
issues.push({ id: 'BS-32', level: 'ERROR', path: `formData.fields[${i}] (${vmodel})`, message: `疑似金额/数量字段, jnpfKey=${key} 应改为 inputNumber` })
}
})
return issues
}