Print the URLs associated with the diagnostics
Change-Id: I1078cbda2b11e5591c96864a57538d6c94004136
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/106430
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Devon Carew <devoncarew@google.com>
diff --git a/pkg/analyzer_cli/lib/src/error_formatter.dart b/pkg/analyzer_cli/lib/src/error_formatter.dart
index 4bcfb70..e6e61f4 100644
--- a/pkg/analyzer_cli/lib/src/error_formatter.dart
+++ b/pkg/analyzer_cli/lib/src/error_formatter.dart
@@ -111,6 +111,7 @@
final String message;
final String errorCode;
final String correction;
+ final String url;
CLIError({
this.severity,
@@ -121,6 +122,7 @@
this.message,
this.errorCode,
this.correction,
+ this.url,
});
@override
@@ -248,10 +250,15 @@
out.write('${ansi.bullet} ${error.errorCode}');
out.writeln();
- // If verbose, also print any associated correction.
- if (options.verbose && error.correction != null) {
- out.writeln(
- '${' '.padLeft(error.severity.length + 2)}${error.correction}');
+ // If verbose, also print any associated correction and URL.
+ if (options.verbose) {
+ String padding = ' '.padLeft(error.severity.length + 2);
+ if (error.correction != null) {
+ out.writeln('$padding${error.correction}');
+ }
+ if (error.url != null) {
+ out.writeln('$padding${error.url}');
+ }
}
}
@@ -303,6 +310,7 @@
message: message,
errorCode: error.errorCode.name.toLowerCase(),
correction: error.correction,
+ url: error.errorCode.url,
));
}
}