OLD | NEW |
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 import 'package:analyzer/error/error.dart'; | 5 import 'package:analyzer/error/error.dart'; |
6 import 'package:analyzer/source/error_processor.dart'; | 6 import 'package:analyzer/source/error_processor.dart'; |
7 import 'package:analyzer/src/error/codes.dart'; | 7 import 'package:analyzer/src/error/codes.dart'; |
8 import 'package:analyzer/src/generated/engine.dart' hide AnalysisResult; | 8 import 'package:analyzer/src/generated/engine.dart' hide AnalysisResult; |
9 import 'package:analyzer_cli/src/error_formatter.dart'; | 9 import 'package:analyzer_cli/src/error_formatter.dart'; |
10 import 'package:analyzer_cli/src/options.dart'; | 10 import 'package:analyzer_cli/src/options.dart'; |
11 | 11 |
12 /// Check various configuration options to get a desired severity for this | 12 /// Check various configuration options to get a desired severity for this |
13 /// [error] (or `null` if it's to be suppressed). | 13 /// [error] (or `null` if it's to be suppressed). |
14 ProcessedSeverity processError(AnalysisError error, | 14 ProcessedSeverity determineProcessedSeverity(AnalysisError error, |
15 CommandLineOptions commandLineOptions, AnalysisOptions analysisOptions) { | 15 CommandLineOptions commandLineOptions, AnalysisOptions analysisOptions) { |
16 ErrorSeverity severity = computeSeverity(error, commandLineOptions, | 16 ErrorSeverity severity = computeSeverity(error, commandLineOptions, |
17 analysisOptions: analysisOptions); | 17 analysisOptions: analysisOptions); |
18 bool isOverridden = false; | 18 bool isOverridden = false; |
19 | 19 |
20 // Skip TODOs categorically (unless escalated to ERROR or HINT.) | 20 // Skip TODOs categorically (unless escalated to ERROR or HINT.) |
21 // https://github.com/dart-lang/sdk/issues/26215 | 21 // https://github.com/dart-lang/sdk/issues/26215 |
22 if (error.errorCode.type == ErrorType.TODO && | 22 if (error.errorCode.type == ErrorType.TODO && |
23 severity == ErrorSeverity.INFO) { | 23 severity == ErrorSeverity.INFO) { |
24 return null; | 24 return null; |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 if (!commandLineOptions.enableTypeChecks && | 63 if (!commandLineOptions.enableTypeChecks && |
64 error.errorCode.type == ErrorType.CHECKED_MODE_COMPILE_TIME_ERROR) { | 64 error.errorCode.type == ErrorType.CHECKED_MODE_COMPILE_TIME_ERROR) { |
65 return ErrorSeverity.INFO; | 65 return ErrorSeverity.INFO; |
66 } else if (commandLineOptions.hintsAreFatal && error.errorCode is HintCode) { | 66 } else if (commandLineOptions.hintsAreFatal && error.errorCode is HintCode) { |
67 return ErrorSeverity.ERROR; | 67 return ErrorSeverity.ERROR; |
68 } else if (commandLineOptions.lintsAreFatal && error.errorCode is LintCode) { | 68 } else if (commandLineOptions.lintsAreFatal && error.errorCode is LintCode) { |
69 return ErrorSeverity.ERROR; | 69 return ErrorSeverity.ERROR; |
70 } | 70 } |
71 return error.errorCode.errorSeverity; | 71 return error.errorCode.errorSeverity; |
72 } | 72 } |
OLD | NEW |