MCPcopy Create free account
hub / github.com/dataform-co/dataform / printFormatFilesResult

Function printFormatFilesResult

cli/console.ts:480–508  ·  view source on GitHub ↗
(
  formatResults: Array<{
    filename: string;
    err?: Error;
    needsFormatting?: boolean;
  }>
)

Source from the content-addressed store, hash-verified

478}
479
480export 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
510function datasetString(target: dataform.ITarget, datasetType: string, disabled: boolean) {
511 return `${targetString(target)} [${datasetType}]${disabled ? " [disabled]" : ""}`;

Callers 1

runCliFunction · 0.90

Calls 4

printSuccessFunction · 0.85
writeStdOutFunction · 0.85
printErrorFunction · 0.85
writeStdErrFunction · 0.85

Tested by

no test coverage detected