Fix: refuse inert exact ignore-value entries (#662)

ignore-value stored exact values for rules that cannot extract one, so the entries never matched. Refuse them and point at "*" --file.

AI assistance: implemented with Cursor Grok 4.6.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Abdul Wahab
2026-08-28 05:43:36 +05:00
committed by Abdul Wahab
co-authored by Cursor
parent af2e8b3ac3
commit be87f5eb86
4 changed files with 38 additions and 0 deletions
+4
View File
@@ -7,6 +7,7 @@ import {
readDetectionConfig,
readRawDetectionConfig,
writeDetectionConfig,
extractFindingIgnoreValue,
} from '../../lib/impeccable-config.mjs';
const ACTION_ALIASES = new Map([
@@ -235,6 +236,9 @@ function addFile(cwd, args) {
function addValue(cwd, args) {
const { local, rest } = parseScope(args);
const parsed = parseValueArgs(rest);
if (parsed.value !== '*' && !extractFindingIgnoreValue({ antipattern: parsed.rule, ignoreValue: parsed.value })) {
throw new Error(`${parsed.rule} has no extractable ignore value. Use impeccable ignores add-value ${parsed.rule} "*" --file <glob> to suppress it in matching files.`);
}
const config = readScopeConfig(cwd, local);
const key = ignoreValueKey(parsed);
const existing = config.ignoreValues.find((entry) => ignoreValueKey(entry) === key);