* Validate the `extensions` map. Every failure mode degrades to "no overrides * from this entry" — a bad value or a typo'd language never throws.
(parsed: object, file: string)
| 232 | * from this entry" — a bad value or a typo'd language never throws. |
| 233 | */ |
| 234 | function extractExtensions(parsed: object, file: string): Record<string, Language> { |
| 235 | const exts = (parsed as ProjectConfig).extensions; |
| 236 | if (!exts || typeof exts !== 'object' || Array.isArray(exts)) return EMPTY_EXTENSIONS; |
| 237 | |
| 238 | const out: Record<string, Language> = {}; |
| 239 | for (const [rawKey, rawVal] of Object.entries(exts)) { |
| 240 | const key = normalizeExtKey(rawKey); |
| 241 | if (!key) { |
| 242 | logWarn(`Ignoring extension mapping in ${PROJECT_CONFIG_FILENAME}: "${rawKey}" is not a valid file extension`, { file }); |
| 243 | continue; |
| 244 | } |
| 245 | if (typeof rawVal !== 'string' || !isLanguageSupported(rawVal as Language)) { |
| 246 | logWarn(`Ignoring extension "${rawKey}" in ${PROJECT_CONFIG_FILENAME}: "${String(rawVal)}" is not a supported language`, { file }); |
| 247 | continue; |
| 248 | } |
| 249 | out[key] = rawVal as Language; |
| 250 | } |
| 251 | |
| 252 | return Object.keys(out).length > 0 ? out : EMPTY_EXTENSIONS; |
| 253 | } |
| 254 | |
| 255 | /** |
| 256 | * Validate the `includeIgnored` patterns: an array of non-empty gitignore-style |
no test coverage detected