@@ -2,7 +2,7 @@ import 'dart:io';
22import 'key_parser.dart' ;
33
44class AuditCommand {
5- Future <void > run ({required String transDir, required String srcDir}) async {
5+ Future <void > run ({required String transDir, required String srcDir, required bool showWarnings }) async {
66 try {
77 final translationDir = Directory (transDir);
88 final sourceDir = Directory (srcDir);
@@ -21,13 +21,13 @@ class AuditCommand {
2121 final allTranslations = await keyParser.parseKeysInTranslationsDir (translationDir);
2222 final usedKeys = keyParser.parseKeysInSourceDir (sourceDir);
2323
24- _report (allTranslations, usedKeys);
24+ _report (allTranslations, usedKeys, showWarnings : showWarnings );
2525 } catch (e) {
2626 stderr.writeln ('Error during audit: $e ' );
2727 }
2828 }
2929
30- void _report (Map <String , Set <String >> allTranslations, Set <String > usedKeys) {
30+ void _report (Map <String , Set <String >> allTranslations, Set <String > usedKeys, { required bool showWarnings} ) {
3131 stderr.writeln ('=== Keys Audit ===' );
3232
3333 for (var lang in allTranslations.keys) {
@@ -37,7 +37,7 @@ class AuditCommand {
3737 final missingWithoutVariables = missing.where ((key) => ! key.contains ('\$ ' )).toList ();
3838
3939 stderr.writeln ('\n Language: $lang ' );
40- if (missingWithVariables.isEmpty && missingWithoutVariables.isEmpty) {
40+ if (( missingWithVariables.isEmpty || ! showWarnings) && missingWithoutVariables.isEmpty) {
4141 stderr.writeln (' ✅ all good!' );
4242 }
4343
@@ -51,7 +51,7 @@ class AuditCommand {
5151 exit (1 );
5252 }
5353
54- if (missingWithVariables.isNotEmpty) {
54+ if (missingWithVariables.isNotEmpty && showWarnings ) {
5555 stderr.writeln (' 🟡 Missing with variables (${missingWithVariables .length }):' );
5656 stderr.writeln (' These keys may not be missing as they contain variables that cannot be verified.' );
5757 for (var key in missingWithVariables) {
0 commit comments