MCPcopy Create free account
hub / github.com/angular/dev-infra / formatFiles

Function formatFiles

ng-dev/format/format.ts:19–39  ·  view source on GitHub ↗
(files: string[])

Source from the content-addressed store, hash-verified

17 * @returns a status code indicating whether the formatting run was successful.
18 */
19export async function formatFiles(files: string[]): Promise<1 | 0> {
20 // Whether any files failed to format.
21 let failures = await runFormatterInParallel(files, 'format');
22
23 if (failures === false) {
24 Log.info('No files matched for formatting.');
25 return 0;
26 }
27
28 // The process should exit as a failure if any of the files failed to format.
29 if (failures.length !== 0) {
30 Log.error(`The following files could not be formatted:`);
31 failures.forEach(({filePath, message}) => {
32 Log.info(` • ${filePath}: ${message}`);
33 });
34 Log.error(`Formatting failed, see errors above for more information.`);
35 return 1;
36 }
37 Log.info(green(`✔ Formatting complete.`));
38 return 0;
39}
40
41/**
42 * Check provided files for formatting correctness.

Callers 4

handlerFunction · 0.90
updateRenovateConfigFunction · 0.85
checkFilesFunction · 0.85

Calls 2

runFormatterInParallelFunction · 0.85
errorMethod · 0.45

Tested by

no test coverage detected