OLD | NEW |
---|---|
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 library analyzer.src.task.options; | 5 library analyzer.src.task.options; |
6 | 6 |
7 import 'package:analyzer/analyzer.dart'; | 7 import 'package:analyzer/analyzer.dart'; |
8 import 'package:analyzer/plugin/options.dart'; | 8 import 'package:analyzer/plugin/options.dart'; |
9 import 'package:analyzer/source/analysis_options_provider.dart'; | 9 import 'package:analyzer/source/analysis_options_provider.dart'; |
10 import 'package:analyzer/src/generated/engine.dart'; | 10 import 'package:analyzer/src/generated/engine.dart'; |
11 import 'package:analyzer/src/generated/source.dart'; | 11 import 'package:analyzer/src/generated/source.dart'; |
12 import 'package:analyzer/src/task/general.dart'; | 12 import 'package:analyzer/src/task/general.dart'; |
13 import 'package:analyzer/task/general.dart'; | 13 import 'package:analyzer/task/general.dart'; |
14 import 'package:analyzer/task/model.dart'; | 14 import 'package:analyzer/task/model.dart'; |
15 import 'package:source_span/source_span.dart'; | 15 import 'package:source_span/source_span.dart'; |
16 import 'package:yaml/yaml.dart'; | 16 import 'package:yaml/yaml.dart'; |
17 | 17 |
18 /// The errors produced while parsing `.analysis_options` files. | 18 /// The errors produced while parsing `.analysis_options` files. |
19 /// | 19 /// |
20 /// The list will be empty if there were no errors, but will not be `null`. | 20 /// The list will be empty if there were no errors, but will not be `null`. |
21 final ListResultDescriptor<AnalysisError> ANALYSIS_OPTIONS_ERRORS = | 21 final ListResultDescriptor<AnalysisError> ANALYSIS_OPTIONS_ERRORS = |
22 new ListResultDescriptor<AnalysisError>( | 22 new ListResultDescriptor<AnalysisError>( |
23 'ANALYSIS_OPTIONS_ERRORS', AnalysisError.NO_ERRORS); | 23 'ANALYSIS_OPTIONS_ERRORS', AnalysisError.NO_ERRORS); |
24 | 24 |
25 /// Validates `analyzer` top-level options. | 25 /// Validates `analyzer` top-level options. |
26 class AnalyzerOptionsValidator extends TopLevelOptionValidator { | 26 class AnalyzerOptionsValidator extends TopLevelOptionValidator { |
27 AnalyzerOptionsValidator() | 27 AnalyzerOptionsValidator() |
28 : super('analyzer', const ['exclude', 'plugins', 'strong-mode']); | 28 : super('analyzer', const ['exclude', 'plugins', 'strong-mode', 'errors']) ; |
Brian Wilkerson
2015/10/28 02:09:08
Seems like these should be constants so that we ca
pquitslund
2015/10/28 15:56:44
Absolutely. Another case of "real" enum-envy. :(
| |
29 } | 29 } |
30 | 30 |
31 /// Convenience class for composing validators. | 31 /// Convenience class for composing validators. |
32 class CompositeValidator extends OptionsValidator { | 32 class CompositeValidator extends OptionsValidator { |
33 final List<OptionsValidator> validators; | 33 final List<OptionsValidator> validators; |
34 CompositeValidator(this.validators); | 34 CompositeValidator(this.validators); |
35 | 35 |
36 @override | 36 @override |
37 void validate(ErrorReporter reporter, Map<String, YamlNode> options) => | 37 void validate(ErrorReporter reporter, Map<String, YamlNode> options) => |
38 validators.forEach((v) => v.validate(reporter, options)); | 38 validators.forEach((v) => v.validate(reporter, options)); |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
156 AnalysisOptionsWarningCode.UNSUPPORTED_OPTION, | 156 AnalysisOptionsWarningCode.UNSUPPORTED_OPTION, |
157 k.span, | 157 k.span, |
158 [pluginName, k.value]); | 158 [pluginName, k.value]); |
159 } | 159 } |
160 } | 160 } |
161 //TODO(pq): consider an error if the node is not a Scalar. | 161 //TODO(pq): consider an error if the node is not a Scalar. |
162 }); | 162 }); |
163 } | 163 } |
164 } | 164 } |
165 } | 165 } |
OLD | NEW |