| 55 | return Object.keys(this.problems).length !== 0; |
| 56 | } |
| 57 | public toString(): string { |
| 58 | stepSummary?.addHeading(`${this.type} Checks`, 2); |
| 59 | if (!this.hasError()) { |
| 60 | stepSummary?.addRaw("✅ all checks passed").addEOL(); |
| 61 | return `${this.type} are all \u001b[32mvalid\u001b[0m`; |
| 62 | } |
| 63 | |
| 64 | Object.entries(this.problems).forEach(([key, problems]) => { |
| 65 | let label: string = this.labels[key as T] ?? `${key}`; |
| 66 | stepSummary |
| 67 | ?.addRaw(`❌ ${label}`) |
| 68 | .addEOL() |
| 69 | .addList(problems as string[]) |
| 70 | .addEOL(); |
| 71 | }); |
| 72 | |
| 73 | return `${this.type} are \u001b[31minvalid\u001b[0m\n${Object.entries( |
| 74 | this.problems, |
| 75 | ) |
| 76 | .map(([key, problems]) => { |
| 77 | let label: string = this.labels[key as T] ?? `${key}`; |
| 78 | |
| 79 | return `${label}:\n ${(problems as string[]) |
| 80 | .map((error) => `\t- ${error}`) |
| 81 | .join("\n")}`; |
| 82 | }) |
| 83 | .join("\n")}`; |
| 84 | } |
| 85 | } |
| 86 | |
| 87 | function findDuplicates<T>(items: T[]): T[] { |