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

Function extractExclude

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

218 * line would, against project-root-relative paths.
219 */
220function extractExclude(parsed: object, file: string): string[] {
221 const raw = (parsed as ProjectConfig).exclude;
222 if (raw === undefined) return [];
223 if (!Array.isArray(raw)) {
224 logWarn(`Ignoring "exclude" in ${PROJECT_CONFIG_FILENAME}: must be an array of gitignore-style patterns`, { file });
225 return [];
226 }
227
228 const out: string[] = [];
229 for (const entry of raw) {
230 if (typeof entry !== 'string' || !entry.trim()) {
231 logWarn(`Ignoring an "exclude" entry in ${PROJECT_CONFIG_FILENAME}: every pattern must be a non-empty string`, { file });
232 continue;
233 }
234 out.push(entry.trim());
235 }
236 return out;
237}
238
239/**
240 * Validate the `include` patterns: an array of non-empty gitignore-style strings

Callers 1

parseConfigFunction · 0.85

Calls 1

logWarnFunction · 0.90

Tested by

no test coverage detected