* 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)
| 307 | * line would, against project-root-relative paths. |
| 308 | */ |
| 309 | function 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 |
no test coverage detected