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