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

Function extractPatternList

src/project-config.ts:285–301  ·  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

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