* 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)
| 184 | * from this entry" — a bad value or a typo'd language never throws. |
| 185 | */ |
| 186 | function extractExtensions(parsed: object, file: string): Record<string, Language> { |
| 187 | const exts = (parsed as ProjectConfig).extensions; |
| 188 | if (!exts || typeof exts !== 'object' || Array.isArray(exts)) return EMPTY_EXTENSIONS; |
| 189 | |
| 190 | const out: Record<string, Language> = {}; |
| 191 | for (const [rawKey, rawVal] of Object.entries(exts)) { |
| 192 | const key = normalizeExtKey(rawKey); |
| 193 | if (!key) { |
| 194 | logWarn(`Ignoring extension mapping in ${PROJECT_CONFIG_FILENAME}: "${rawKey}" is not a valid file extension`, { file }); |
| 195 | continue; |
| 196 | } |
| 197 | if (typeof rawVal !== 'string' || !isLanguageSupported(rawVal as Language)) { |
| 198 | logWarn(`Ignoring extension "${rawKey}" in ${PROJECT_CONFIG_FILENAME}: "${String(rawVal)}" is not a supported language`, { file }); |
| 199 | continue; |
| 200 | } |
| 201 | out[key] = rawVal as Language; |
| 202 | } |
| 203 | |
| 204 | return Object.keys(out).length > 0 ? out : EMPTY_EXTENSIONS; |
| 205 | } |
| 206 | |
| 207 | /** |
| 208 | * Validate the `includeIgnored` patterns: an array of non-empty gitignore-style |
no test coverage detected