MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / extractPatternList

Function extractPatternList

src/project-config.ts:284–300  ·  view source on GitHub ↗

* Validate a gitignore-style pattern list under `key`. A non-array value or a * non-string/blank entry warns-and-skips; never throws. Patterns are kept * verbatim (trimmed) so they match exactly as a `.gitignore` line would.

(parsed: object, file: string, key: 'deprioritize')

Source from the content-addressed store, hash-verified

282 * verbatim (trimmed) so they match exactly as a `.gitignore` line would.
283 */
284function extractPatternList(parsed: object, file: string, key: 'deprioritize'): string[] {
285 const raw = (parsed as ProjectConfig)[key];
286 if (raw === undefined) return [];
287 if (!Array.isArray(raw)) {
288 logWarn(`Ignoring "${key}" in ${PROJECT_CONFIG_FILENAME}: must be an array of gitignore-style patterns`, { file });
289 return [];
290 }
291 const out: string[] = [];
292 for (const entry of raw) {
293 if (typeof entry !== 'string' || !entry.trim()) {
294 logWarn(`Ignoring a "${key}" entry in ${PROJECT_CONFIG_FILENAME}: every pattern must be a non-empty string`, { file });
295 continue;
296 }
297 out.push(entry.trim());
298 }
299 return out;
300}
301
302/**
303 * Validate the `exclude` patterns: an array of non-empty gitignore-style

Callers 1

parseConfigFunction · 0.85

Calls 2

logWarnFunction · 0.90
pushMethod · 0.80

Tested by

no test coverage detected