* Validate the `include` patterns: an array of non-empty gitignore-style strings * naming first-party source to force INTO the index despite `.gitignore` — the * whitelist for SVN/Perforce-only source a project gitignores out of Git (the * general case `includeIgnored` never covered). A non-array
(parsed: object, file: string)
| 246 | * project-root-relative paths. |
| 247 | */ |
| 248 | function extractInclude(parsed: object, file: string): string[] { |
| 249 | const raw = (parsed as ProjectConfig).include; |
| 250 | if (raw === undefined) return []; |
| 251 | if (!Array.isArray(raw)) { |
| 252 | logWarn(`Ignoring "include" in ${PROJECT_CONFIG_FILENAME}: must be an array of gitignore-style patterns`, { file }); |
| 253 | return []; |
| 254 | } |
| 255 | |
| 256 | const out: string[] = []; |
| 257 | for (const entry of raw) { |
| 258 | if (typeof entry !== 'string' || !entry.trim()) { |
| 259 | logWarn(`Ignoring an "include" entry in ${PROJECT_CONFIG_FILENAME}: every pattern must be a non-empty string`, { file }); |
| 260 | continue; |
| 261 | } |
| 262 | out.push(entry.trim()); |
| 263 | } |
| 264 | return out; |
| 265 | } |
| 266 | |
| 267 | /** |
| 268 | * Load the parsed `codegraph.json` for a project, mtime-cached. A missing or |
no test coverage detected