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

Function extractExclude

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

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