Skip to content

Commit

Permalink
No public description
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 569163924
  • Loading branch information
Googler authored and copybara-github committed Sep 28, 2023
1 parent 9010671 commit 00d1eb7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
1 change: 1 addition & 0 deletions pkgs/intl_translation/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
## 0.19.0-dev
* Always generate null safe code, remove `null-safe` flag.
* Add example for `he` locale.
* MessageExtraction: add set of error codes to be ignored in analysis.

## 0.18.1
* Update analyzer dependency to `5.2.0`.
Expand Down
10 changes: 6 additions & 4 deletions pkgs/intl_translation/lib/extract_messages.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import 'dart:io';
import 'package:analyzer/dart/analysis/features.dart';
import 'package:analyzer/dart/analysis/utilities.dart';
import 'package:analyzer/dart/ast/ast.dart';
import 'package:analyzer/src/error/codes.dart';

import 'src/messages/main_message.dart';
import 'visitors/message_finding_visitor.dart';
Expand All @@ -46,11 +45,15 @@ class MessageExtraction {
this.examplesRequired = false,
this.descriptionRequired = false,
this.warningsAreErrors = false,
this.ignoredErrorCodes = const <String>{},
}) : warnings = [];

/// If this is true, then treat all warnings as errors.
bool warningsAreErrors;

/// Error codes that should be ignored.
Set<String> ignoredErrorCodes;

/// What to do when a message is encountered, defaults to [print].
OnMessage onMessage;

Expand Down Expand Up @@ -130,9 +133,8 @@ class MessageExtraction {
);

final errors = List.of(result.errors)
// google3 specific modification: ignore DOC_DIRECTIVE_UNKNOWN.
// See b/301549069.
..removeWhere((e) => e.errorCode == WarningCode.DOC_DIRECTIVE_UNKNOWN);
..removeWhere(
(e) => ignoredErrorCodes.contains(e.errorCode.name.toLowerCase()));
if (errors.isNotEmpty) {
print('Error in parsing $origin, no messages extracted.');
throw ArgumentError('Parsing errors in $origin');
Expand Down

0 comments on commit 00d1eb7

Please sign in to comment.