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

Function extractPatternList

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

235 * verbatim (trimmed) so they match exactly as a `.gitignore` line would.
236 */
237function extractPatternList(parsed: object, file: string, key: 'deprioritize'): string[] {
238 const raw = (parsed as ProjectConfig)[key];
239 if (raw === undefined) return [];
240 if (!Array.isArray(raw)) {
241 logWarn(`Ignoring "${key}" in ${PROJECT_CONFIG_FILENAME}: must be an array of gitignore-style patterns`, { file });
242 return [];
243 }
244 const out: string[] = [];
245 for (const entry of raw) {
246 if (typeof entry !== 'string' || !entry.trim()) {
247 logWarn(`Ignoring a "${key}" entry in ${PROJECT_CONFIG_FILENAME}: every pattern must be a non-empty string`, { file });
248 continue;
249 }
250 out.push(entry.trim());
251 }
252 return out;
253}
254
255/**
256 * 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