Include warnings in the static error updater tool.

A while back, we changed the test runner to validate warnings in static
error tests, so this gets the updater tool to parity with that.

Also, when printing analyzer errors, sort them by location before
severity.

Change-Id: Ia07e79adb6d7ca19a50210a2813d7f2f7e60f7e1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148285
Auto-Submit: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
Commit-Queue: Bob Nystrom <rnystrom@google.com>
This commit is contained in:
Robert Nystrom 2020-05-26 18:24:20 +00:00 committed by commit-bot@chromium.org
parent db063ea6d0
commit bd6e3733a7
2 changed files with 4 additions and 3 deletions

View file

@ -536,11 +536,11 @@ class AnalyzerError implements Comparable<AnalyzerError> {
@override
int compareTo(AnalyzerError other) {
if (severity != other.severity) return severity.compareTo(other.severity);
if (file != other.file) return file.compareTo(other.file);
if (line != other.line) return line.compareTo(other.line);
if (column != other.column) return column.compareTo(other.column);
if (length != other.length) return length.compareTo(other.length);
if (severity != other.severity) return severity.compareTo(other.severity);
if (errorCode != other.errorCode) {
return errorCode.compareTo(other.errorCode);
}

View file

@ -223,8 +223,9 @@ Future<List<StaticError>> runAnalyzer(String path, List<String> options) async {
}
var errors = <StaticError>[];
AnalysisCommandOutput.parseErrors(result.stderr as String, errors);
return errors;
var warnings = <StaticError>[];
AnalysisCommandOutput.parseErrors(result.stderr as String, errors, warnings);
return [...errors, ...warnings];
}
/// Invoke CFE on [path] and gather all static errors it reports.