{"record":{"id":"c4d641629c6db813","repo":"pbakaus/impeccable","slug":"reason-is-not-supported-for-ignore-file-because-c4d641","errorCode":null,"errorMessage":"--reason is not supported for ignore-file because detector.ignoreFiles stores globs only; use ignore-value when a documented rule-specific exception fits","messagePattern":"--reason is not supported for ignore-file because detector\\.ignoreFiles stores globs only; use ignore-value when a documented rule-specific exception fits","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"skill/scripts/hook-admin.mjs","lineNumber":601,"sourceCode":"  const config = mergeDetectorConfig(readRawDetectorConfig(cwd));\n  if (!config.ignoreRules.includes(rule)) config.ignoreRules.push(rule);\n  writeDetectorConfig(cwd, config);\n  return `Added \"${rule}\" to detector.ignoreRules. Current: ${config.ignoreRules.join(', ')}`;\n}\n\nfunction parseIgnoreFileArgs(args) {\n  const positionals = [];\n  let shared = false;\n  let local = false;\n\n  for (const raw of args) {\n    const arg = String(raw || '');\n    if (arg === '--shared') {\n      shared = true;\n    } else if (arg === '--local') {\n      local = true;\n    } else if (arg === '--reason' || arg.startsWith('--reason=')) {\n      throw new Error('--reason is not supported for ignore-file because detector.ignoreFiles stores globs only; use ignore-value when a documented rule-specific exception fits');\n    } else if (arg.startsWith('--')) {\n      throw new Error(`Unknown ignore-file flag: ${arg}`);\n    } else {\n      positionals.push(arg);\n    }\n  }\n\n  if (shared && local) throw new Error('Pass only one scope flag: --shared or --local');\n  if (positionals.length > 1) throw new Error('Pass exactly one glob to ignore-file');\n\n  return {\n    glob: positionals[0],\n    local,\n  };\n}\n\nfunction addIgnoreFile(cwd, args) {\n  const parsed = parseIgnoreFileArgs(args);","sourceCodeStart":583,"sourceCodeEnd":619,"githubUrl":"https://github.com/pbakaus/impeccable/blob/d14711ae3d1a1dd62dee61a358d27f107c51ccd0/skill/scripts/hook-admin.mjs#L583-L619","documentation":"Thrown by parseIgnoreFileArgs when --reason or --reason=<text> is passed to ignore-file. detector.ignoreFiles stores only glob patterns, so a per-reason file suppression has no place to live. The error steers the user toward ignore-value, which supports documented rule-specific exceptions. This is a hard refusal, not a warning, because silently dropping --reason would let the user believe a reason-scoped suppression was recorded when it was not.","triggerScenarios":"Copy-pasting --reason from an ignore-value invocation into ignore-file; expecting per-reason file exclusions; a wrapper that always forwards --reason.","commonSituations":"A user who suppresses a finding for 'this legacy file' and wants the reason recorded; CI automation that attaches --reason uniformly.","solutions":["Drop --reason from the ignore-file call — detector.ignoreFiles accepts globs only.","If a documented rule-specific exception fits, use `impeccable hooks ignore-value <rule> <value> --reason <text>` instead.","Record the reason in a commit message or comment rather than expecting ignore-file to store it."],"exampleFix":"# before\nimpeccable hooks ignore-file \"src/legacy/**\" --reason \"legacy module\"\n\n# after (ignore-file stores globs only)\nimpeccable hooks ignore-file \"src/legacy/**\"\n# if a rule-specific exception fits:\nimpeccable hooks ignore-value side-tab inter --reason \"legacy module\"","handlingStrategy":"validation","validationCode":"// Strip --reason from ignore-file invocations before they reach the parser.\nfunction stripReasonForIgnoreFile(args) {\n  const out = [];\n  for (let i = 0; i < args.length; i++) {\n    if (args[i] === '--reason') { i++; continue; }      // skip value too\n    if (String(args[i]).startsWith('--reason=')) continue;\n    out.push(args[i]);\n  }\n  return out;\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["ignore-file stores globs only — never pass --reason to it.","Use ignore-value <rule> <value> --reason <text> when a documented exception fits.","Record reasons in commit messages, not in detector.ignoreFiles."],"tags":["cli","hooks","validation","config","footgun"],"backgroundTag":null,"analyzedSha":"d14711ae3d1a1dd62dee61a358d27f107c51ccd0","analyzedAt":"2026-08-13T00:52:25.771Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}