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

Function extractExclude

src/project-config.ts:309–326  ·  view source on GitHub ↗

* Validate the `exclude` patterns: an array of non-empty gitignore-style * strings naming paths to keep out of the index even when git-tracked (#999). 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 `

(parsed: object, file: string)

Source from the content-addressed store, hash-verified

307 * line would, against project-root-relative paths.
308 */
309function extractExclude(parsed: object, file: string): string[] {
310 const raw = (parsed as ProjectConfig).exclude;
311 if (raw === undefined) return [];
312 if (!Array.isArray(raw)) {
313 logWarn(`Ignoring "exclude" in ${PROJECT_CONFIG_FILENAME}: must be an array of gitignore-style patterns`, { file });
314 return [];
315 }
316
317 const out: string[] = [];
318 for (const entry of raw) {
319 if (typeof entry !== 'string' || !entry.trim()) {
320 logWarn(`Ignoring an "exclude" entry in ${PROJECT_CONFIG_FILENAME}: every pattern must be a non-empty string`, { file });
321 continue;
322 }
323 out.push(entry.trim());
324 }
325 return out;
326}
327
328/**
329 * Validate the `include` patterns: an array of non-empty gitignore-style strings

Callers 1

parseConfigFunction · 0.85

Calls 2

logWarnFunction · 0.90
pushMethod · 0.80

Tested by

no test coverage detected