* 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)
| 260 | * line would, against project-root-relative paths. |
| 261 | */ |
| 262 | function extractExclude(parsed: object, file: string): string[] { |
| 263 | const raw = (parsed as ProjectConfig).exclude; |
| 264 | if (raw === undefined) return []; |
| 265 | if (!Array.isArray(raw)) { |
| 266 | logWarn(`Ignoring "exclude" in ${PROJECT_CONFIG_FILENAME}: must be an array of gitignore-style patterns`, { file }); |
| 267 | return []; |
| 268 | } |
| 269 | |
| 270 | const out: string[] = []; |
| 271 | for (const entry of raw) { |
| 272 | if (typeof entry !== 'string' || !entry.trim()) { |
| 273 | logWarn(`Ignoring an "exclude" entry in ${PROJECT_CONFIG_FILENAME}: every pattern must be a non-empty string`, { file }); |
| 274 | continue; |
| 275 | } |
| 276 | out.push(entry.trim()); |
| 277 | } |
| 278 | return out; |
| 279 | } |
| 280 | |
| 281 | /** |
| 282 | * Validate the `include` patterns: an array of non-empty gitignore-style strings |
no test coverage detected