Skip to content

Commit 650109a

Browse files
committed
Refactor auditStrings to ensure silent mode suppresses result output and improve comment formatting
1 parent 606e793 commit 650109a

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

src/extractors/auditStrings.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,21 @@ export function audit(args: Args, translationsUnion: SetOfBlocks) {
1212
console.log("\nAudit Complete!");
1313
if (auditor.getResults().length === 0) {
1414
console.log("No issues found! 🎉");
15-
//if there are no errors, we can remove the audit.log file
15+
// if there are no errors, we can remove the audit.log file
1616
try {
1717
unlinkSync(path.join(args.paths.cwd, "audit.log"));
1818
} catch (_error) {
1919
//ignore
2020
}
2121
} else {
2222
console.log(`Found ${auditor.getResults().length} issues!`);
23-
const results = auditor.getResults().join("\n");
24-
console.log(results);
23+
// Print the results if not in silent mode
24+
if (args.options?.silent !== true) {
25+
const results = auditor.getResults().join("\n");
26+
console.log(results);
27+
}
2528
/** Write the audit results to a file */
26-
writeFileSync(path.join(args.paths.cwd, "audit.log"), results);
29+
writeFileSync(path.join(args.paths.cwd, "audit.log"), auditor.getResults().join("\n"));
2730
}
2831
}
2932

0 commit comments

Comments
 (0)