{"record":{"id":"3b7c48c47f2aace5","repo":"pbakaus/impeccable","slug":"pass-a-rule-id-e-g-impeccable-command-hooks-i","errorCode":null,"errorMessage":"Pass a rule id, e.g. ${IMPECCABLE_COMMAND} hooks ignore-rule side-tab","messagePattern":"Pass a rule id, e\\.g\\. (.+?) hooks ignore-rule side-tab","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"plugin/skills/impeccable/scripts/hook-admin.mjs","lineNumber":579,"sourceCode":"    } else if (arg.startsWith('--reason=')) {\n      // Accepted for command symmetry; ignoreRules stores rule ids only.\n    } else if (arg.startsWith('--')) {\n      throw new Error(`Unknown ignore-rule flag: ${arg}`);\n    } else {\n      positionals.push(arg);\n    }\n  }\n\n  return {\n    rule: normalizeRuleId(positionals[0]),\n    allValues,\n  };\n}\n\nfunction addIgnoreRule(cwd, args) {\n  const parsed = parseIgnoreRuleArgs(args);\n  const rule = parsed.rule;\n  if (!rule) throw new Error(`Pass a rule id, e.g. ${IMPECCABLE_COMMAND} hooks ignore-rule side-tab`);\n  if (rule === 'overused-font' && !parsed.allValues) {\n    throw new Error(`overused-font is value-specific by default. Use ${IMPECCABLE_COMMAND} hooks ignore-value overused-font <font> for a confirmed font, or ${IMPECCABLE_COMMAND} hooks ignore-rule overused-font --all-values only when the user asked to ignore overused fonts generally.`);\n  }\n  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;","sourceCodeStart":561,"sourceCodeEnd":597,"githubUrl":"https://github.com/pbakaus/impeccable/blob/d14711ae3d1a1dd62dee61a358d27f107c51ccd0/plugin/skills/impeccable/scripts/hook-admin.mjs#L561-L597","documentation":"addIgnoreRule() requires one positional argument: the rule id to add to detector.ignoreRules. normalizeRuleId trims and lowercases the first positional; if the result is empty the command throws with a concrete example. This stops a no-op invocation from reporting success with no rule added.","triggerScenarios":"Running `hooks ignore-rule` with no positional at all, or with only flags (e.g. `hooks ignore-rule --all-values` and nothing else), so positionals[0] is undefined.","commonSituations":"Forgetting the rule id; expecting the flag to imply a rule; a script that builds the argv dynamically and drops the empty positional.","solutions":["Provide a rule id, e.g. `hooks ignore-rule side-tab`.","If automating, ensure the rule positional is non-empty before invoking the command."],"exampleFix":"# before\nimpeccable hooks ignore-rule\n\n# after\nimpeccable hooks ignore-rule side-tab","handlingStrategy":"validation","validationCode":"const rule = normalizeRuleId(positionals[0]);\nif (!rule) {\n  throw new Error('Pass a rule id, e.g. /impeccable hooks ignore-rule side-tab');\n}","typeGuard":"function hasRuleId(positionalZero) {\n  return typeof positionalZero === 'string' && positionalZero.trim() !== '';\n}","tryCatchPattern":null,"preventionTips":["Always pass a rule id positional to ignore-rule.","When scripting, assert the rule arg is non-empty before running the command."],"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"}