(configs: HostConfig[])
| 156 | } |
| 157 | |
| 158 | export function validateAllConfigs(configs: HostConfig[]): string[] { |
| 159 | const errors: string[] = []; |
| 160 | |
| 161 | // Per-config validation |
| 162 | for (const config of configs) { |
| 163 | const configErrors = validateHostConfig(config); |
| 164 | errors.push(...configErrors.map(e => `[${config.name}] ${e}`)); |
| 165 | } |
| 166 | |
| 167 | // Cross-config uniqueness checks |
| 168 | const hostSubdirs = new Map<string, string>(); |
| 169 | const globalRoots = new Map<string, string>(); |
| 170 | const names = new Map<string, string>(); |
| 171 | |
| 172 | for (const config of configs) { |
| 173 | if (names.has(config.name)) { |
| 174 | errors.push(`Duplicate name '${config.name}' (also used by ${names.get(config.name)})`); |
| 175 | } |
| 176 | names.set(config.name, config.name); |
| 177 | |
| 178 | if (hostSubdirs.has(config.hostSubdir)) { |
| 179 | errors.push(`Duplicate hostSubdir '${config.hostSubdir}' (${config.name} and ${hostSubdirs.get(config.hostSubdir)})`); |
| 180 | } |
| 181 | hostSubdirs.set(config.hostSubdir, config.name); |
| 182 | |
| 183 | if (globalRoots.has(config.globalRoot)) { |
| 184 | errors.push(`Duplicate globalRoot '${config.globalRoot}' (${config.name} and ${globalRoots.get(config.globalRoot)})`); |
| 185 | } |
| 186 | globalRoots.set(config.globalRoot, config.name); |
| 187 | } |
| 188 | |
| 189 | return errors; |
| 190 | } |
no test coverage detected