(
formatResults: Array<{
filename: string;
err?: Error;
needsFormatting?: boolean;
}>
)
| 478 | } |
| 479 | |
| 480 | export function printFormatFilesResult( |
| 481 | formatResults: Array<{ |
| 482 | filename: string; |
| 483 | err?: Error; |
| 484 | needsFormatting?: boolean; |
| 485 | }> |
| 486 | ) { |
| 487 | const sorted = formatResults.sort((a, b) => a.filename.localeCompare(b.filename)); |
| 488 | const successfulFormatResults = sorted.filter(result => !result.err && !result.needsFormatting); |
| 489 | const needsFormattingResults = sorted.filter(result => !result.err && result.needsFormatting); |
| 490 | const failedFormatResults = sorted.filter(result => !!result.err); |
| 491 | |
| 492 | if (successfulFormatResults.length > 0) { |
| 493 | printSuccess("Successfully formatted:"); |
| 494 | successfulFormatResults.forEach(result => writeStdOut(result.filename, 1)); |
| 495 | } |
| 496 | |
| 497 | if (needsFormattingResults.length > 0) { |
| 498 | printError("Files that need formatting:"); |
| 499 | needsFormattingResults.forEach(result => writeStdErr(result.filename, 1)); |
| 500 | } |
| 501 | |
| 502 | if (failedFormatResults.length > 0) { |
| 503 | printError("Errors encountered during formatting:"); |
| 504 | failedFormatResults.forEach(result => |
| 505 | writeStdOut(`${result.filename}: ${result.err.message}`, 1) |
| 506 | ); |
| 507 | } |
| 508 | } |
| 509 | |
| 510 | function datasetString(target: dataform.ITarget, datasetType: string, disabled: boolean) { |
| 511 | return `${targetString(target)} [${datasetType}]${disabled ? " [disabled]" : ""}`; |
no test coverage detected