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

Unified Diff: pkg/analyzer_cli/lib/src/analyzer_impl.dart

Issue 2857203002: Make the exit code for dartanalyzer more deterministic. (Closed)
Patch Set: Created 3 years, 8 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 | pkg/analyzer_cli/lib/src/build_mode.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer_cli/lib/src/analyzer_impl.dart
diff --git a/pkg/analyzer_cli/lib/src/analyzer_impl.dart b/pkg/analyzer_cli/lib/src/analyzer_impl.dart
index 90a94d9b55ff21a4ca219b23182f7f29fe2e4122..d9ea1ab350e83dbaaf638bc49685363f89985981 100644
--- a/pkg/analyzer_cli/lib/src/analyzer_impl.dart
+++ b/pkg/analyzer_cli/lib/src/analyzer_impl.dart
@@ -65,15 +65,14 @@ class AnalyzerImpl {
this.librarySource, this.options, this.stats, this.startTime);
/// Returns the maximal [ErrorSeverity] of the recorded errors.
- ErrorSeverity get maxErrorSeverity {
+ ErrorSeverity computeMaxErrorSeverity() {
ErrorSeverity status = ErrorSeverity.NONE;
for (AnalysisErrorInfo errorInfo in errorInfos) {
for (AnalysisError error in errorInfo.errors) {
if (_defaultSeverityProcessor(error) == null) {
continue;
}
- ErrorSeverity severity = computeSeverity(error, options);
- status = status.max(severity);
+ status = status.max(computeSeverity(error, options, analysisOptions));
}
}
return status;
@@ -185,12 +184,8 @@ class AnalyzerImpl {
_printColdPerf();
}
- // Compute max severity and set exitCode.
- ErrorSeverity status = maxErrorSeverity;
- if (status == ErrorSeverity.WARNING && options.warningsAreFatal) {
- status = ErrorSeverity.ERROR;
- }
- return status;
+ // Compute and return max severity.
+ return computeMaxErrorSeverity();
}
/// Returns true if we want to report diagnostics for this library.
@@ -242,7 +237,7 @@ class AnalyzerImpl {
outSink.writeln("total-cold:$totalTime");
}
- ProcessedSeverity _defaultSeverityProcessor(AnalysisError error) =>
+ ErrorSeverity _defaultSeverityProcessor(AnalysisError error) =>
determineProcessedSeverity(error, options, analysisOptions);
Future<LibraryElement> _resolveLibrary() async {
« no previous file with comments | « no previous file | pkg/analyzer_cli/lib/src/build_mode.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698