Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1256)

Unified Diff: lib/src/analyzer_impl.dart

Issue 1382023002: Support for --fatal-hints. (Closed) Base URL: https://github.com/dart-lang/analyzer_cli.git@master
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | lib/src/error_formatter.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/analyzer_impl.dart
diff --git a/lib/src/analyzer_impl.dart b/lib/src/analyzer_impl.dart
index 5460cb318da71b9d6126158dd4b2902d80029e22..06c8e94d8946e53c8be40cc26088408b9877b36a 100644
--- a/lib/src/analyzer_impl.dart
+++ b/lib/src/analyzer_impl.dart
@@ -65,7 +65,7 @@ class AnalyzerImpl {
if (!_isDesiredError(error)) {
continue;
}
- var severity = computeSeverity(error, options.enableTypeChecks);
+ var severity = computeSeverity(error, options);
status = status.max(severity);
}
}
@@ -190,7 +190,7 @@ class AnalyzerImpl {
if (error.errorCode.type == ErrorType.TODO) {
return false;
}
- if (computeSeverity(error, options.enableTypeChecks) ==
+ if (computeSeverity(error, options) ==
ErrorSeverity.INFO &&
options.disableHints) {
return false;
@@ -242,15 +242,19 @@ class AnalyzerImpl {
formatter.formatErrors(errorInfos);
}
- /// Compute the severity of the error; however, if
- /// [enableTypeChecks] is false, then de-escalate checked-mode compile time
- /// errors to a severity of [ErrorSeverity.INFO].
+ /// Compute the severity of the error; however:
+ /// * if [options.enableTypeChecks] is false, then de-escalate checked-mode
+ /// compile time errors to a severity of [ErrorSeverity.INFO].
+ /// * if [options.hintsAreFatal] is true, escalate hints to errors.
static ErrorSeverity computeSeverity(
- AnalysisError error, bool enableTypeChecks) {
- if (!enableTypeChecks &&
+ AnalysisError error, CommandLineOptions options) {
+ if (!options.enableTypeChecks &&
error.errorCode.type == ErrorType.CHECKED_MODE_COMPILE_TIME_ERROR) {
return ErrorSeverity.INFO;
}
+ if (options.hintsAreFatal && error.errorCode is HintCode) {
+ return ErrorSeverity.ERROR;
+ }
return error.errorCode.errorSeverity;
}
« no previous file with comments | « no previous file | lib/src/error_formatter.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698