{"record":{"id":"f9a4336ff8d01312","repo":"pbakaus/impeccable","slug":"pass-a-glob-e-g-impeccable-command-hooks-igno","errorCode":null,"errorMessage":"Pass a glob, e.g. ${IMPECCABLE_COMMAND} hooks ignore-file \"src/legacy/**\"","messagePattern":"Pass a glob, e\\.g\\. (.+?) hooks ignore-file \"src/legacy/\\*\\*\"","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"plugin/skills/impeccable/scripts/hook-admin.mjs","lineNumber":621,"sourceCode":"      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);\n  const glob = parsed.glob;\n  if (!glob) throw new Error(`Pass a glob, e.g. ${IMPECCABLE_COMMAND} hooks ignore-file \"src/legacy/**\"`);\n  const config = mergeDetectorConfig(readRawDetectorConfig(cwd, { local: parsed.local }));\n  if (!config.ignoreFiles.includes(glob)) config.ignoreFiles.push(glob);\n  const target = writeDetectorConfig(cwd, config, { local: parsed.local });\n  const scope = parsed.local ? 'local detector.ignoreFiles' : 'shared detector.ignoreFiles';\n  return `Added \"${glob}\" to ${scope} (${path.relative(cwd, target) || target}). Current: ${config.ignoreFiles.join(', ')}`;\n}\n\n// An empty glob used to be dropped by filter(Boolean), so `--file=` reported\n// success and wrote an entry with no files: the user asked to scope a rule to one\n// file and silently got the project-wide suppression instead. Refuse it.\nfunction requireGlob(raw, flag) {\n  const glob = String(raw ?? '').trim();\n  if (!glob) throw new Error(`${flag} requires a non-empty glob`);\n  // A following flag is not a glob. `--file --reason \"why\"` consumed `--reason`\n  // as the scope and left the reason text to fold into the value, storing\n  // value=\"* why\" files=[\"--reason\"] and reporting success. Same silent-no-op\n  // class as an unknown flag folding into the value; refuse it the same way.\n  if (glob.startsWith('--')) throw new Error(`${flag} requires a glob, got the flag ${glob}`);","sourceCodeStart":603,"sourceCodeEnd":639,"githubUrl":"https://github.com/pbakaus/impeccable/blob/d14711ae3d1a1dd62dee61a358d27f107c51ccd0/plugin/skills/impeccable/scripts/hook-admin.mjs#L603-L639","documentation":"addIgnoreFile() requires one positional: the glob to add to detector.ignoreFiles. If parseIgnoreFileArgs returns an empty glob (no positional supplied), the command refuses rather than writing an empty entry that would scope nothing.","triggerScenarios":"Running `hooks ignore-file` with no positional, or with only flags (e.g. `hooks ignore-file --shared`).","commonSituations":"Forgetting the glob; a templated command that omits the path under some condition.","solutions":["Provide exactly one glob positional, e.g. `hooks ignore-file \"src/legacy/**\"`."],"exampleFix":"# before\nimpeccable hooks ignore-file\n\n# after\nimpeccable hooks ignore-file \"src/legacy/**\"","handlingStrategy":"validation","validationCode":"const glob = positionals[0];\nif (!glob) {\n  throw new Error('Pass a glob, e.g. /impeccable hooks ignore-file \"src/legacy/**\"');\n}","typeGuard":"function hasGlob(positionalZero) {\n  return typeof positionalZero === 'string' && positionalZero.trim() !== '';\n}","tryCatchPattern":null,"preventionTips":["Always supply one glob positional to ignore-file.","Quote globs to prevent shell expansion."],"tags":["cli","argument-parsing","validation"],"backgroundTag":null,"analyzedSha":"d14711ae3d1a1dd62dee61a358d27f107c51ccd0","analyzedAt":"2026-08-13T00:52:25.771Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}